summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-23 21:22:41 +0100
committerGitHub <noreply@github.com>2020-03-23 21:22:41 +0100
commit02de8d576b531430f90ef2ab7a290c7fb59e9f3c (patch)
tree9d9d8a2c06f2791e83e77673435253a1a21a42e6 /pkg
parent3e835a8025bfc4a7a2790f1d343c6ea246fc65ee (diff)
parent9ac58fd78e4f04f3807f18020124882ad68e3ffb (diff)
downloadpodman-02de8d576b531430f90ef2ab7a290c7fb59e9f3c.tar.gz
podman-02de8d576b531430f90ef2ab7a290c7fb59e9f3c.tar.bz2
podman-02de8d576b531430f90ef2ab7a290c7fb59e9f3c.zip
Merge pull request #5560 from QiWang19/remote_ceds
Use creds form PullImage remote
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/runtime_remote.go10
-rw-r--r--pkg/varlinkapi/images.go10
2 files changed, 16 insertions, 4 deletions
diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go
index d87de481c..fc396eddb 100644
--- a/pkg/adapter/runtime_remote.go
+++ b/pkg/adapter/runtime_remote.go
@@ -291,7 +291,8 @@ func (r *LocalRuntime) NewImageFromLocal(name string) (*ContainerImage, error) {
// LoadFromArchiveReference creates an image from a local archive
func (r *LocalRuntime) LoadFromArchiveReference(ctx context.Context, srcRef types.ImageReference, signaturePolicyPath string, writer io.Writer) ([]*ContainerImage, error) {
var iid string
- reply, err := iopodman.PullImage().Send(r.Conn, varlink.More, srcRef.DockerReference().String())
+ creds := iopodman.AuthConfig{}
+ reply, err := iopodman.PullImage().Send(r.Conn, varlink.More, srcRef.DockerReference().String(), creds)
if err != nil {
return nil, err
}
@@ -323,7 +324,12 @@ func (r *LocalRuntime) New(ctx context.Context, name, signaturePolicyPath, authf
if label != nil {
return nil, errors.New("the remote client function does not support checking a remote image for a label")
}
- reply, err := iopodman.PullImage().Send(r.Conn, varlink.More, name)
+ creds := iopodman.AuthConfig{}
+ if dockeroptions.DockerRegistryCreds != nil {
+ creds.Username = dockeroptions.DockerRegistryCreds.Username
+ creds.Password = dockeroptions.DockerRegistryCreds.Password
+ }
+ reply, err := iopodman.PullImage().Send(r.Conn, varlink.More, name, creds)
if err != nil {
return nil, err
}
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go
index c4809f16b..2dfb84e58 100644
--- a/pkg/varlinkapi/images.go
+++ b/pkg/varlinkapi/images.go
@@ -688,12 +688,18 @@ func (i *LibpodAPI) ExportImage(call iopodman.VarlinkCall, name, destination str
}
// PullImage pulls an image from a registry to the image store.
-func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string) error {
+func (i *LibpodAPI) PullImage(call iopodman.VarlinkCall, name string, creds iopodman.AuthConfig) error {
var (
imageID string
err error
)
- dockerRegistryOptions := image.DockerRegistryOptions{}
+ dockerRegistryOptions := image.DockerRegistryOptions{
+ DockerRegistryCreds: &types.DockerAuthConfig{
+ Username: creds.Username,
+ Password: creds.Password,
+ },
+ }
+
so := image.SigningOptions{}
if call.WantsMore() {