Skip to content

Commit

Permalink
daemon/RegistryHosts: Don't lose mirrors
Browse files Browse the repository at this point in the history
`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 <[email protected]>
  • Loading branch information
vvoland committed Oct 11, 2023
1 parent a67b755 commit d871a66
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,15 @@ 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
c.Insecure = &t
}
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
Expand Down

0 comments on commit d871a66

Please sign in to comment.