Set default scheme in registryEndpoints for host
Signed-off-by: Erik Wilson <Erik.E.Wilson@gmail.com>
This commit is contained in:
parent
73e5fa0f34
commit
7cc3938717
@ -310,10 +310,6 @@ func (c *criService) registryHosts(auth *runtime.AuthConfig) docker.RegistryHost
|
||||
config = c.config.Registry.Configs[u.Host]
|
||||
)
|
||||
|
||||
if u.Scheme == "" {
|
||||
u.Scheme = defaultScheme(u.Host)
|
||||
}
|
||||
|
||||
if u.Scheme != "https" && config.TLS != nil {
|
||||
return nil, errors.Errorf("tls provided for http endpoint %q", e)
|
||||
}
|
||||
@ -355,8 +351,7 @@ func defaultScheme(host string) string {
|
||||
if h, _, err := net.SplitHostPort(host); err == nil {
|
||||
host = h
|
||||
}
|
||||
if host == "localhost" || host == "127.0.0.1" ||
|
||||
host == "::1" {
|
||||
if host == "localhost" || host == "127.0.0.1" || host == "::1" {
|
||||
return "http"
|
||||
}
|
||||
return "https"
|
||||
@ -387,7 +382,7 @@ func (c *criService) registryEndpoints(host string) ([]string, error) {
|
||||
return endpoints, nil
|
||||
}
|
||||
}
|
||||
return append(endpoints, "https://"+defaultHost), nil
|
||||
return append(endpoints, defaultScheme(defaultHost)+"://"+defaultHost), nil
|
||||
}
|
||||
|
||||
// newTransport returns a new HTTP transport used to pull image.
|
||||
|
Loading…
Reference in New Issue
Block a user