From c7eb73bd072d53aeed8f8a3e2c1ecf668277411c Mon Sep 17 00:00:00 2001 From: Divyanshu Pandey Date: Sun, 24 May 2026 14:18:33 +0530 Subject: [PATCH] Pull images used in volumes with type=image When running 'docker compose pull', images referenced in volume mounts with type=image were not being pulled. The pull() function only iterated service images, while pullRequiredImages() (used by 'docker compose up') already handled volume images. This adds the same volume image discovery logic to the pull() function, so that 'docker compose pull' also pulls images used in type=image volume mounts. Fixes #13809 Signed-off-by: Divyanshu Pandey --- pkg/compose/pull.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/pkg/compose/pull.go b/pkg/compose/pull.go index f1b6a64a12..2819585725 100644 --- a/pkg/compose/pull.go +++ b/pkg/compose/pull.go @@ -67,6 +67,32 @@ func (s *composeService) pull(ctx context.Context, project *types.Project, opts i := 0 for name, service := range project.Services { + for j, vol := range service.Volumes { + if vol.Type != types.VolumeTypeImage { + continue + } + + if _, ok := imagesBeingPulled[vol.Source]; ok { + continue + } + imagesBeingPulled[vol.Source] = name + + volService := types.ServiceConfig{ + Name: fmt.Sprintf("%s:volume %d", name, j), + Image: vol.Source, + } + + eg.Go(func() error { + _, err := s.pullServiceImage(ctx, volService, opts.Quiet, project.Environment["DOCKER_DEFAULT_PLATFORM"]) + if err != nil { + s.events.On(errorEvent("Image "+vol.Source, getUnwrappedErrorMessage(err))) + if !opts.IgnoreFailures { + return err + } + } + return nil + }) + } if service.Image == "" { s.events.On(api.Resource{ ID: name,