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

Function runServices

cmd/compose/config.go:350–382  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, opts configOptions)

Source from the content-addressed store, hash-verified

348}
349
350func runServices(ctx context.Context, dockerCli command.Cli, opts configOptions) error {
351 if opts.noInterpolate {
352 // we can't use ToProject, so the model we render here is only partially resolved
353 data, err := opts.ToModel(ctx, dockerCli, nil, cli.WithoutEnvironmentResolution)
354 if err != nil {
355 return err
356 }
357
358 if _, ok := data["services"]; ok {
359 for serviceName := range data["services"].(map[string]any) {
360 _, _ = fmt.Fprintln(dockerCli.Out(), serviceName)
361 }
362 }
363
364 return nil
365 }
366
367 backend, err := compose.NewComposeService(dockerCli)
368 if err != nil {
369 return err
370 }
371
372 project, _, err := opts.ProjectOptions.ToProject(ctx, dockerCli, backend, nil, cli.WithoutEnvironmentResolution)
373 if err != nil {
374 return err
375 }
376 err = project.ForEachService(project.ServiceNames(), func(serviceName string, _ *types.ServiceConfig) error {
377 _, _ = fmt.Fprintln(dockerCli.Out(), serviceName)
378 return nil
379 })
380
381 return err
382}
383
384func runVolumes(ctx context.Context, dockerCli command.Cli, opts configOptions) error {
385 backend, err := compose.NewComposeService(dockerCli)

Callers 1

configCommandFunction · 0.85

Calls 4

NewComposeServiceFunction · 0.92
ToModelMethod · 0.45
OutMethod · 0.45
ToProjectMethod · 0.45

Tested by

no test coverage detected