Prechádzať zdrojové kódy

daemon/RegistryHosts: Don't lose mirrors

`docker.io` is present in the `IndexConfigs` so the `Mirrors` property
would get lost because a fresh `RegistryConfig` object was created.

Instead of creating a new object, reuse the existing one and just
mutate its fields.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski 1 rok pred
rodič
commit
d871a665de
1 zmenil súbory, kde vykonal 2 pridanie a 3 odobranie
  1. 2 3
      daemon/daemon.go

+ 2 - 3
daemon/daemon.go

@@ -196,7 +196,7 @@ func (daemon *Daemon) RegistryHosts(host string) ([]docker.RegistryHost, error)
 	}
 	conf := daemon.registryService.ServiceConfig().IndexConfigs
 	for k, v := range conf {
-		c := resolverconfig.RegistryConfig{}
+		c := m[k]
 		if !v.Secure {
 			t := true
 			c.PlainHTTP = &t
@@ -204,8 +204,7 @@ func (daemon *Daemon) RegistryHosts(host string) ([]docker.RegistryHost, error)
 		}
 		m[k] = c
 	}
-	if _, ok := m[host]; !ok && daemon.registryService.IsInsecureRegistry(host) {
-		c := resolverconfig.RegistryConfig{}
+	if c, ok := m[host]; !ok && daemon.registryService.IsInsecureRegistry(host) {
 		t := true
 		c.PlainHTTP = &t
 		c.Insecure = &t