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

Method Apply

cmd/compose/create.go:165–197  ·  cmd/compose/create.go::createOptions.Apply
(project *types.Project)

Source from the content-addressed store, hash-verified

163}
164
165func (opts createOptions) Apply(project *types.Project) error {
166 if opts.pullChanged {
167 if !opts.isPullPolicyValid() {
168 return fmt.Errorf("invalid --pull option %q", opts.Pull)
169 }
170 for i, service := range project.Services {
171 service.PullPolicy = opts.Pull
172 project.Services[i] = service
173 }
174 }
175 // N.B. opts.Build means "force build all", but images can still be built
176 // when this is false
177 // e.g. if a service has pull_policy: build or its local image is policy
178 if opts.Build {
179 for i, service := range project.Services {
180 if service.Build == nil {
181 continue
182 }
183 service.PullPolicy = types.PullPolicyBuild
184 project.Services[i] = service
185 }
186 }
187
188 if err := applyPlatforms(project, true); err != nil {
189 return err
190 }
191
192 err := applyScaleOpts(project, opts.scale)
193 if err != nil {
194 return err
195 }
196 return nil
197}
198
199func applyScaleOpts(project *types.Project, opts []string) error {
200 for _, scale := range opts {

Callers 5

runUpFunction · 0.45
pullCommandFunction · 0.45
RootCommandFunction · 0.45
runRunFunction · 0.45
runCreateFunction · 0.45

Calls 3

isPullPolicyValidMethod · 0.95
applyPlatformsFunction · 0.85
applyScaleOptsFunction · 0.85

Tested by

no test coverage detected