@@ -48,15 +48,6 @@ func (s *composeService) Pull(ctx context.Context, project *types.Project, optio
4848}
4949
5050func (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-
6051 images , err := s .getLocalImagesDigests (ctx , project )
6152 if err != nil {
6253 return err
@@ -123,7 +114,7 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts
123114 imagesBeingPulled [service .Image ] = service .Name
124115
125116 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" ])
127118 if err != nil {
128119 pullErrors [i ] = err
129120 if service .Build != nil {
@@ -173,7 +164,7 @@ func imageAlreadyPresent(serviceImage string, localImages map[string]string) boo
173164 return ok && tagged .Tag () != "latest"
174165}
175166
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 ,
177168 configFile driver.Auth , w progress.Writer , quietPull bool , defaultPlatform string ) (string , error ) {
178169 w .Event (progress.Event {
179170 ID : service .Name ,
@@ -185,7 +176,7 @@ func (s *composeService) pullServiceImage(ctx context.Context, service types.Ser
185176 return "" , err
186177 }
187178
188- encodedAuth , err := encodedAuth (ref , info , configFile )
179+ encodedAuth , err := encodedAuth (ref , configFile )
189180 if err != nil {
190181 return "" , err
191182 }
@@ -249,17 +240,13 @@ func (s *composeService) pullServiceImage(ctx context.Context, service types.Ser
249240 return inspected .ID , nil
250241}
251242
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 ) {
253244 repoInfo , err := registry .ParseRepositoryInfo (ref )
254245 if err != nil {
255246 return "" , err
256247 }
257248
258- key := repoInfo .Index .Name
259- if repoInfo .Index .Official {
260- key = info .IndexServerAddress
261- }
262-
249+ key := registry .GetAuthConfigKey (repoInfo .Index )
263250 authConfig , err := configFile .GetAuthConfig (key )
264251 if err != nil {
265252 return "" , err
@@ -273,15 +260,6 @@ func encodedAuth(ref reference.Named, info moby.Info, configFile driver.Auth) (s
273260}
274261
275262func (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-
285263 var needPull []types.ServiceConfig
286264 for _ , service := range project .Services {
287265 if service .Image == "" {
@@ -311,7 +289,7 @@ func (s *composeService) pullRequiredImages(ctx context.Context, project *types.
311289 for i , service := range needPull {
312290 i , service := i , service
313291 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" ])
315293 pulledImages [i ] = id
316294 if err != nil && isServiceImageToBuild (service , project .Services ) {
317295 // image can be built, so we can ignore pull failure
0 commit comments