MCPcopy
hub / github.com/docker/compose / pull

Method pull

pkg/compose/pull.go:53–151  ·  pkg/compose/pull.go::composeService.pull
(ctx context.Context, project *types.Project, opts api.PullOptions)

Source from the content-addressed store, hash-verified

51}
52
53func (s *composeService) pull(ctx context.Context, project *types.Project, opts api.PullOptions) error { //nolint:gocyclo
54 images, err := s.getLocalImagesDigests(ctx, project)
55 if err != nil {
56 return err
57 }
58
59 eg, ctx := errgroup.WithContext(ctx)
60 eg.SetLimit(s.maxConcurrency)
61
62 var (
63 mustBuild []string
64 pullErrors = make([]error, len(project.Services))
65 imagesBeingPulled = map[string]string{}
66 )
67
68 i := 0
69 for name, service := range project.Services {
70 if service.Image == "" {
71 s.events.On(api.Resource{
72 ID: name,
73 Status: api.Done,
74 Text: "Skipped",
75 Details: "No image to be pulled",
76 })
77 continue
78 }
79
80 switch service.PullPolicy {
81 case types.PullPolicyNever, types.PullPolicyBuild:
82 s.events.On(api.Resource{
83 ID: "Image " + service.Image,
84 Status: api.Done,
85 Text: "Skipped",
86 })
87 continue
88 case types.PullPolicyMissing, types.PullPolicyIfNotPresent:
89 if imageAlreadyPresent(service.Image, images) {
90 s.events.On(api.Resource{
91 ID: "Image " + service.Image,
92 Status: api.Done,
93 Text: "Skipped",
94 Details: "Image is already present locally",
95 })
96 continue
97 }
98 }
99
100 if service.Build != nil && opts.IgnoreBuildable {
101 s.events.On(api.Resource{
102 ID: "Image " + service.Image,
103 Status: api.Done,
104 Text: "Skipped",
105 Details: "Image can be built",
106 })
107 continue
108 }
109
110 if _, ok := imagesBeingPulled[service.Image]; ok {

Callers 1

PullMethod · 0.95

Calls 6

getLocalImagesDigestsMethod · 0.95
pullServiceImageMethod · 0.95
imageAlreadyPresentFunction · 0.85
errorEventfFunction · 0.85
OnMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected