瀏覽代碼

daemon: support using CIDR notation for getting registry hosts

insecure-registries supports using CIDR notation, however, buildkit in
moby was not respecting these. We can update the RegistryHosts function
to support this by inserting the correct host into the lookup map if
it's explicitly marked as insecure.

Signed-off-by: Justin Chadwell <me@jedevc.com>
Justin Chadwell 2 年之前
父節點
當前提交
eb68c5e747
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      daemon/daemon.go

+ 7 - 0
daemon/daemon.go

@@ -207,6 +207,13 @@ func (daemon *Daemon) RegistryHosts(host string) ([]docker.RegistryHost, error)
 		}
 		m[k] = c
 	}
+	if _, ok := m[host]; !ok && daemon.registryService.IsInsecureRegistry(host) {
+		c := resolverconfig.RegistryConfig{}
+		t := true
+		c.PlainHTTP = &t
+		c.Insecure = &t
+		m[host] = c
+	}
 
 	for k, v := range m {
 		v.TLSConfigDir = []string{registry.HostCertsDir(k)}