@@ -48,15 +48,6 @@ func (s *composeService) Pull(ctx context.Context, project *types.Project, optio
48
48
}
49
49
50
50
func (s * composeService ) pull (ctx context.Context , project * types.Project , opts api.PullOptions ) error { //nolint:gocyclo
51
- info , err := s .apiClient ().Info (ctx )
52
- if err != nil {
53
- return err
54
- }
55
-
56
- if info .IndexServerAddress == "" {
57
- info .IndexServerAddress = registry .IndexServer
58
- }
59
-
60
51
images , err := s .getLocalImagesDigests (ctx , project )
61
52
if err != nil {
62
53
return err
@@ -123,7 +114,7 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts
123
114
imagesBeingPulled [service .Image ] = service .Name
124
115
125
116
eg .Go (func () error {
126
- _ , err := s .pullServiceImage (ctx , service , info , s .configFile (), w , false , project .Environment ["DOCKER_DEFAULT_PLATFORM" ])
117
+ _ , err := s .pullServiceImage (ctx , service , s .configFile (), w , false , project .Environment ["DOCKER_DEFAULT_PLATFORM" ])
127
118
if err != nil {
128
119
pullErrors [i ] = err
129
120
if service .Build != nil {
@@ -173,7 +164,7 @@ func imageAlreadyPresent(serviceImage string, localImages map[string]string) boo
173
164
return ok && tagged .Tag () != "latest"
174
165
}
175
166
176
- func (s * composeService ) pullServiceImage (ctx context.Context , service types.ServiceConfig , info moby. Info ,
167
+ func (s * composeService ) pullServiceImage (ctx context.Context , service types.ServiceConfig ,
177
168
configFile driver.Auth , w progress.Writer , quietPull bool , defaultPlatform string ) (string , error ) {
178
169
w .Event (progress.Event {
179
170
ID : service .Name ,
@@ -185,7 +176,7 @@ func (s *composeService) pullServiceImage(ctx context.Context, service types.Ser
185
176
return "" , err
186
177
}
187
178
188
- encodedAuth , err := encodedAuth (ref , info , configFile )
179
+ encodedAuth , err := encodedAuth (ref , configFile )
189
180
if err != nil {
190
181
return "" , err
191
182
}
@@ -249,17 +240,13 @@ func (s *composeService) pullServiceImage(ctx context.Context, service types.Ser
249
240
return inspected .ID , nil
250
241
}
251
242
252
- func encodedAuth (ref reference.Named , info moby. Info , configFile driver.Auth ) (string , error ) {
243
+ func encodedAuth (ref reference.Named , configFile driver.Auth ) (string , error ) {
253
244
repoInfo , err := registry .ParseRepositoryInfo (ref )
254
245
if err != nil {
255
246
return "" , err
256
247
}
257
248
258
- key := repoInfo .Index .Name
259
- if repoInfo .Index .Official {
260
- key = info .IndexServerAddress
261
- }
262
-
249
+ key := registry .GetAuthConfigKey (repoInfo .Index )
263
250
authConfig , err := configFile .GetAuthConfig (key )
264
251
if err != nil {
265
252
return "" , err
@@ -273,15 +260,6 @@ func encodedAuth(ref reference.Named, info moby.Info, configFile driver.Auth) (s
273
260
}
274
261
275
262
func (s * composeService ) pullRequiredImages (ctx context.Context , project * types.Project , images map [string ]string , quietPull bool ) error {
276
- info , err := s .apiClient ().Info (ctx )
277
- if err != nil {
278
- return err
279
- }
280
-
281
- if info .IndexServerAddress == "" {
282
- info .IndexServerAddress = registry .IndexServer
283
- }
284
-
285
263
var needPull []types.ServiceConfig
286
264
for _ , service := range project .Services {
287
265
if service .Image == "" {
@@ -311,7 +289,7 @@ func (s *composeService) pullRequiredImages(ctx context.Context, project *types.
311
289
for i , service := range needPull {
312
290
i , service := i , service
313
291
eg .Go (func () error {
314
- id , err := s .pullServiceImage (ctx , service , info , s .configFile (), w , quietPull , project .Environment ["DOCKER_DEFAULT_PLATFORM" ])
292
+ id , err := s .pullServiceImage (ctx , service , s .configFile (), w , quietPull , project .Environment ["DOCKER_DEFAULT_PLATFORM" ])
315
293
pulledImages [i ] = id
316
294
if err != nil && isServiceImageToBuild (service , project .Services ) {
317
295
// image can be built, so we can ignore pull failure
0 commit comments