Skip to content

Commit

Permalink
introduce --remove-orphans in compose create command
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
  • Loading branch information
ndeloof committed Jan 11, 2023
1 parent cc7e69c commit cc912c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/compose/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func createCommand(p *ProjectOptions, backend api.Service) *cobra.Command {
flags.StringVar(&opts.Pull, "pull", "missing", `Pull image before running ("always"|"missing"|"never")`)
flags.BoolVar(&opts.forceRecreate, "force-recreate", false, "Recreate containers even if their configuration and image haven't changed.")
flags.BoolVar(&opts.noRecreate, "no-recreate", false, "If containers already exist, don't recreate them. Incompatible with --force-recreate.")
flags.BoolVar(&opts.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file.")
return cmd
}

Expand Down
1 change: 1 addition & 0 deletions docs/reference/compose_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Creates containers for a service.
| `--no-build` | | | Don't build an image, even if it's missing. |
| `--no-recreate` | | | If containers already exist, don't recreate them. Incompatible with --force-recreate. |
| `--pull` | `string` | `missing` | Pull image before running ("always"\|"missing"\|"never") |
| `--remove-orphans` | | | Remove containers for services not defined in the Compose file. |


<!---MARKER_GEN_END-->
Expand Down
10 changes: 10 additions & 0 deletions docs/reference/docker_compose_create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ options:
experimentalcli: false
kubernetes: false
swarm: false
- option: remove-orphans
value_type: bool
default_value: "false"
description: Remove containers for services not defined in the Compose file.
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false
deprecated: false
experimental: false
experimentalcli: false
Expand Down

0 comments on commit cc912c6

Please sign in to comment.