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

Function runCreate

cmd/compose/create.go:99–132  ·  view source on GitHub ↗
(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, createOpts createOptions, buildOpts buildOptions, project *types.Project, services []string)

Source from the content-addressed store, hash-verified

97}
98
99func runCreate(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, createOpts createOptions, buildOpts buildOptions, project *types.Project, services []string) error {
100 if err := createOpts.Apply(project); err != nil {
101 return err
102 }
103
104 var build *api.BuildOptions
105 if !createOpts.noBuild {
106 bo, err := buildOpts.toAPIBuildOptions(services)
107 if err != nil {
108 return err
109 }
110 build = &bo
111 }
112
113 if createOpts.AssumeYes {
114 backendOptions.Options = append(backendOptions.Options, compose.WithPrompt(compose.AlwaysOkPrompt()))
115 }
116
117 backend, err := compose.NewComposeService(dockerCli, backendOptions.Options...)
118 if err != nil {
119 return err
120 }
121 return backend.Create(ctx, project, api.CreateOptions{
122 Build: build,
123 Services: services,
124 RemoveOrphans: createOpts.removeOrphans,
125 IgnoreOrphans: createOpts.ignoreOrphans,
126 Recreate: createOpts.recreateStrategy(),
127 RecreateDependencies: createOpts.dependenciesRecreateStrategy(),
128 Inherit: !createOpts.noInherit,
129 Timeout: createOpts.GetTimeout(),
130 QuietPull: createOpts.quietPull,
131 })
132}
133
134func (opts createOptions) recreateStrategy() string {
135 if opts.noRecreate {

Callers 1

createCommandFunction · 0.85

Calls 9

WithPromptFunction · 0.92
AlwaysOkPromptFunction · 0.92
NewComposeServiceFunction · 0.92
toAPIBuildOptionsMethod · 0.80
recreateStrategyMethod · 0.80
GetTimeoutMethod · 0.80
CreateMethod · 0.65
ApplyMethod · 0.45

Tested by

no test coverage detected