(ctx context.Context, backend api.Compose, project *types.Project, options runOptions, createOpts createOptions, buildOpts buildOptions, dockerCli command.Cli)
| 270 | } |
| 271 | |
| 272 | func runRun(ctx context.Context, backend api.Compose, project *types.Project, options runOptions, createOpts createOptions, buildOpts buildOptions, dockerCli command.Cli) error { |
| 273 | project, err := options.apply(project) |
| 274 | if err != nil { |
| 275 | return err |
| 276 | } |
| 277 | |
| 278 | err = createOpts.Apply(project) |
| 279 | if err != nil { |
| 280 | return err |
| 281 | } |
| 282 | |
| 283 | if err := checksForRemoteStack(ctx, dockerCli, project, buildOpts, createOpts.AssumeYes, []string{}); err != nil { |
| 284 | return err |
| 285 | } |
| 286 | |
| 287 | labels := types.Labels{} |
| 288 | for _, s := range options.labels { |
| 289 | key, val, ok := strings.Cut(s, "=") |
| 290 | if !ok { |
| 291 | return fmt.Errorf("label must be set as KEY=VALUE") |
| 292 | } |
| 293 | labels[key] = val |
| 294 | } |
| 295 | |
| 296 | var buildForRun *api.BuildOptions |
| 297 | if !createOpts.noBuild { |
| 298 | bo, err := buildOpts.toAPIBuildOptions(nil) |
| 299 | if err != nil { |
| 300 | return err |
| 301 | } |
| 302 | buildForRun = &bo |
| 303 | } |
| 304 | |
| 305 | environment, err := options.getEnvironment(project.Environment.Resolve) |
| 306 | if err != nil { |
| 307 | return err |
| 308 | } |
| 309 | |
| 310 | // start container and attach to container streams |
| 311 | runOpts := api.RunOptions{ |
| 312 | CreateOptions: api.CreateOptions{ |
| 313 | Build: buildForRun, |
| 314 | RemoveOrphans: options.removeOrphans, |
| 315 | IgnoreOrphans: options.ignoreOrphans, |
| 316 | QuietPull: options.quietPull, |
| 317 | }, |
| 318 | Name: options.name, |
| 319 | Service: options.Service, |
| 320 | Command: options.Command, |
| 321 | Detach: options.Detach, |
| 322 | AutoRemove: options.Remove, |
| 323 | Tty: !options.noTty, |
| 324 | Interactive: options.interactive, |
| 325 | WorkingDir: options.workdir, |
| 326 | User: options.user, |
| 327 | CapAdd: options.capAdd.GetSlice(), |
| 328 | CapDrop: options.capDrop.GetSlice(), |
| 329 | Environment: environment.Values(), |
no test coverage detected