@@ -22,9 +22,7 @@ const (
22
22
defaultPath = "/v2"
23
23
)
24
24
25
- func fillInsecureOpts (host string , c config.RegistryConfig , h docker.RegistryHost ) ([]docker.RegistryHost , error ) {
26
- var hosts []docker.RegistryHost
27
-
25
+ func fillInsecureOpts (host string , c config.RegistryConfig , h docker.RegistryHost ) (* docker.RegistryHost , error ) {
28
26
tc , err := loadTLSConfig (c )
29
27
if err != nil {
30
28
return nil , err
@@ -54,24 +52,17 @@ func fillInsecureOpts(host string, c config.RegistryConfig, h docker.RegistryHos
54
52
Transport : tracing .NewTransport (transport ),
55
53
}
56
54
tc .InsecureSkipVerify = true
57
- hosts = append ( hosts , h2 )
55
+ return & h2 , nil
58
56
} else if isHTTP {
59
57
h2 := h
60
58
h2 .Scheme = "http"
61
- hosts = append ( hosts , h2 )
59
+ return & h2 , nil
62
60
}
63
61
64
- if len (hosts ) == 0 {
65
- transport := newDefaultTransport ()
66
- transport .TLSClientConfig = tc
67
-
68
- h .Client = & http.Client {
69
- Transport : tracing .NewTransport (transport ),
70
- }
71
- hosts = append (hosts , h )
62
+ h .Client = & http.Client {
63
+ Transport : tracing .NewTransport (httpsTransport ),
72
64
}
73
-
74
- return hosts , nil
65
+ return & h , nil
75
66
}
76
67
77
68
func loadTLSConfig (c config.RegistryConfig ) (* tls.Config , error ) {
@@ -138,12 +129,12 @@ func NewRegistryConfig(m map[string]config.RegistryConfig) docker.RegistryHosts
138
129
for _ , rawMirror := range c .Mirrors {
139
130
h := newMirrorRegistryHost (rawMirror )
140
131
mirrorHost := h .Host
141
- hosts , err := fillInsecureOpts (mirrorHost , m [mirrorHost ], h )
132
+ host , err := fillInsecureOpts (mirrorHost , m [mirrorHost ], h )
142
133
if err != nil {
143
134
return nil , err
144
135
}
145
136
146
- out = append (out , hosts ... )
137
+ out = append (out , * host )
147
138
}
148
139
149
140
if host == "docker.io" {
@@ -163,7 +154,8 @@ func NewRegistryConfig(m map[string]config.RegistryConfig) docker.RegistryHosts
163
154
return nil , err
164
155
}
165
156
166
- out = append (out , hosts ... )
157
+ out = append (out , * hosts )
158
+
167
159
return out , nil
168
160
},
169
161
docker .ConfigureDefaultRegistries (
0 commit comments