Add remove-orphans functionality to run, because it recommends that in error messages

Signed-off-by: Matt Armand <marmand68@gmail.com>
This commit is contained in:
Matt Armand 2023-01-11 10:19:02 -05:00
parent 4ad87463c5
commit bd8e57447a
3 changed files with 12 additions and 1 deletions

View File

@ -162,6 +162,7 @@ func runCommand(p *ProjectOptions, streams api.Streams, backend api.Service) *co
flags.BoolVar(&opts.servicePorts, "service-ports", false, "Run command with the service's ports enabled and mapped to the host.") flags.BoolVar(&opts.servicePorts, "service-ports", false, "Run command with the service's ports enabled and mapped to the host.")
flags.BoolVar(&opts.quietPull, "quiet-pull", false, "Pull without printing progress information.") flags.BoolVar(&opts.quietPull, "quiet-pull", false, "Pull without printing progress information.")
flags.BoolVar(&createOpts.Build, "build", false, "Build image before starting container.") flags.BoolVar(&createOpts.Build, "build", false, "Build image before starting container.")
flags.BoolVar(&opts.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file.")
cmd.Flags().BoolVarP(&opts.interactive, "interactive", "i", true, "Keep STDIN open even if not attached.") cmd.Flags().BoolVarP(&opts.interactive, "interactive", "i", true, "Keep STDIN open even if not attached.")
cmd.Flags().BoolP("tty", "t", true, "Allocate a pseudo-TTY.") cmd.Flags().BoolP("tty", "t", true, "Allocate a pseudo-TTY.")

View File

@ -24,6 +24,7 @@ Run a one-off command on a service.
| `-u`, `--user` | `string` | | Run as specified username or uid | | `-u`, `--user` | `string` | | Run as specified username or uid |
| `-v`, `--volume` | `stringArray` | | Bind mount a volume. | | `-v`, `--volume` | `stringArray` | | Bind mount a volume. |
| `-w`, `--workdir` | `string` | | Working directory inside the container | | `-w`, `--workdir` | `string` | | Working directory inside the container |
| `--remove-orphans` | | | Remove containers for services not defined in the Compose file. |
<!---MARKER_GEN_END--> <!---MARKER_GEN_END-->

View File

@ -246,9 +246,18 @@ options:
experimentalcli: false experimentalcli: false
kubernetes: false kubernetes: false
swarm: 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 deprecated: false
experimental: false experimental: false
experimentalcli: false experimentalcli: false
kubernetes: false kubernetes: false
swarm: false swarm: false