From fc78c93ad2a54c96f06c199d58de822652722009 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Wed, 23 Dec 2020 15:53:12 -0500 Subject: [PATCH] fix creds sync from yaml Pass down the creds from yaml file only if the values are not empty. Enables to use credentials from other authfiles alternatively. Signed-off-by: Qi Wang --- cmd/skopeo/sync.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/skopeo/sync.go b/cmd/skopeo/sync.go index 048b03ec..317c3c8f 100644 --- a/cmd/skopeo/sync.go +++ b/cmd/skopeo/sync.go @@ -280,8 +280,9 @@ func imagesToCopyFromRegistry(registryName string, cfg registrySyncConfig, sourc serverCtx.DockerDaemonCertPath = cfg.CertDir serverCtx.DockerDaemonInsecureSkipTLSVerify = (cfg.TLSVerify.skip == types.OptionalBoolTrue) serverCtx.DockerInsecureSkipTLSVerify = cfg.TLSVerify.skip - serverCtx.DockerAuthConfig = &cfg.Credentials - + if cfg.Credentials != (types.DockerAuthConfig{}) { + serverCtx.DockerAuthConfig = &cfg.Credentials + } var repoDescList []repoDescriptor for imageName, refs := range cfg.Images { repoLogger := logrus.WithFields(logrus.Fields{