util/resolver: Fix insecure mirrors#4293
Conversation
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 <pawel.gronowski@docker.com>
|
Context: The mirrors in Docker were broken after this PR: moby/moby#45992 Actually, there are 2 issues:
|
| for _, rawMirror := range c.Mirrors { | ||
| h := newMirrorRegistryHost(rawMirror) | ||
| mirrorHost := h.Host | ||
| hosts, err := fillInsecureOpts(mirrorHost, m[mirrorHost], h) |
There was a problem hiding this comment.
Ok I think I understand this :)
This fix LGTM - since RegistryConfig always supported multiple URLs, this code was always wrong then? And just didn't ever appear, since we were never using it in this way from moby.
Mirrors in
RegistryConfig.Mirrorscan 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
RegistryConfigbeing passed to thefillInsecureOptsfunction and didn't set the insecure options.Use Host part of the parsed registry as a key instead.