Skip to content

Commit 857b47b

Browse files
committed
util/resolver: Fix insecure mirrors
Mirrors in `RegistryConfig.Mirrors` can be specified using a full URL (schema, trailing slashes) but registries in the input map are keyed by their hostname. Previous code used the mirror URL as key which resulted in an empty `RegistryConfig` being passed to the `fillInsecureOpts` function and didn't set the insecure options. Use Host part of the parsed registry as a key instead. Signed-off-by: Paweł Gronowski <[email protected]> (cherry picked from commit ec65557) Signed-off-by: Paweł Gronowski <[email protected]>
1 parent 567a994 commit 857b47b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

util/resolver/resolver.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ func NewRegistryConfig(m map[string]config.RegistryConfig) docker.RegistryHosts
130130

131131
var out []docker.RegistryHost
132132

133-
for _, mirror := range c.Mirrors {
134-
h := newMirrorRegistryHost(mirror)
135-
hosts, err := fillInsecureOpts(mirror, m[mirror], h)
133+
for _, rawMirror := range c.Mirrors {
134+
h := newMirrorRegistryHost(rawMirror)
135+
mirrorHost := h.Host
136+
hosts, err := fillInsecureOpts(mirrorHost, m[mirrorHost], h)
136137
if err != nil {
137138
return nil, err
138139
}

0 commit comments

Comments
 (0)