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

Function runUp

cmd/compose/up.go:232–353  ·  view source on GitHub ↗

nolint:gocyclo

(
	ctx context.Context,
	dockerCli command.Cli,
	backendOptions *BackendOptions,
	createOptions createOptions,
	upOptions upOptions,
	buildOptions buildOptions,
	project *types.Project,
	services []string,
)

Source from the content-addressed store, hash-verified

230
231//nolint:gocyclo
232func runUp(
233 ctx context.Context,
234 dockerCli command.Cli,
235 backendOptions *BackendOptions,
236 createOptions createOptions,
237 upOptions upOptions,
238 buildOptions buildOptions,
239 project *types.Project,
240 services []string,
241) error {
242 if err := checksForRemoteStack(ctx, dockerCli, project, buildOptions, createOptions.AssumeYes, []string{}); err != nil {
243 return err
244 }
245
246 err := createOptions.Apply(project)
247 if err != nil {
248 return err
249 }
250
251 project, err = upOptions.apply(project, services)
252 if err != nil {
253 return err
254 }
255
256 var build *api.BuildOptions
257 if !createOptions.noBuild {
258 if createOptions.quietPull {
259 buildOptions.Progress = string(xprogress.QuietMode)
260 }
261 // BuildOptions here is nested inside CreateOptions, so
262 // no service list is passed, it will implicitly pick all
263 // services being created, which includes any explicitly
264 // specified via "services" arg here as well as deps
265 bo, err := buildOptions.toAPIBuildOptions(nil)
266 if err != nil {
267 return err
268 }
269 bo.Services = project.ServiceNames()
270 bo.Deps = !upOptions.noDeps
271 build = &bo
272 }
273
274 create := api.CreateOptions{
275 Build: build,
276 Services: services,
277 RemoveOrphans: createOptions.removeOrphans,
278 IgnoreOrphans: createOptions.ignoreOrphans,
279 Recreate: createOptions.recreateStrategy(),
280 RecreateDependencies: createOptions.dependenciesRecreateStrategy(),
281 Inherit: !createOptions.noInherit,
282 Timeout: createOptions.GetTimeout(),
283 QuietPull: createOptions.quietPull,
284 }
285
286 if createOptions.AssumeYes {
287 backendOptions.Options = append(backendOptions.Options, compose.WithPrompt(compose.AlwaysOkPrompt()))
288 }
289

Calls 15

WithPromptFunction · 0.92
AlwaysOkPromptFunction · 0.92
NewComposeServiceFunction · 0.92
NewLogConsumerFunction · 0.92
NewSetFunction · 0.92
checksForRemoteStackFunction · 0.85
toAPIBuildOptionsMethod · 0.80
recreateStrategyMethod · 0.80
GetTimeoutMethod · 0.80
DiffMethod · 0.80
ElementsMethod · 0.80