Backport to release 1.4.
@@ -339,9 +339,17 @@ func (c *criService) registryHosts(auth *runtime.AuthConfig) docker.RegistryHost
}
}
+ // Make a copy of `auth`, so that different authorizers would not reference
+ // the same auth variable.
+ auth := auth
if auth == nil && config.Auth != nil {
auth = toRuntimeAuthConfig(*config.Auth)
}
+ authorizer := docker.NewDockerAuthorizer(
+ docker.WithAuthClient(client),
+ docker.WithAuthCreds(func(host string) (string, string, error) {
+ return ParseAuth(auth, host)
+ }))
if u.Path == "" {
u.Path = "/v2"
@@ -349,11 +357,7 @@ func (c *criService) registryHosts(auth *runtime.AuthConfig) docker.RegistryHost
registries = append(registries, docker.RegistryHost{
Client: client,
- Authorizer: docker.NewDockerAuthorizer(
- docker.WithAuthClient(client),
- docker.WithAuthCreds(func(host string) (string, string, error) {
- return ParseAuth(auth, host)
- })),
+ Authorizer: authorizer,
Host: u.Host,
Scheme: u.Scheme,
Path: u.Path,
