Skip to content

Commit

Permalink
fix(run): a container is not cleaned up after execution by default
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
  • Loading branch information
alexey-igrychev committed Sep 8, 2022
1 parent bc691f2 commit c04367c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/werf/run/run.go
Expand Up @@ -53,7 +53,7 @@ func NewCmd(ctx context.Context) *cobra.Command {
Short: "Run container for project image",
Long: common.GetLongCommandDescription(`Run container for specified project image from werf.yaml (build if needed)`),
DisableFlagsInUseLine: true,
Example: ` # Run specified image
Example: ` # Run specified image and remove after execution
$ werf run application
# Run image with predefined docker run options and command for debug
Expand Down Expand Up @@ -105,6 +105,8 @@ func NewCmd(ctx context.Context) *cobra.Command {
common.PrintHelp(cmd)
return fmt.Errorf("shell option cannot be used with other docker run arguments")
}
} else if len(cmdData.DockerOptions) == 0 {
cmdData.DockerOptions = append(cmdData.DockerOptions, "--rm")
}

return runMain(ctx)
Expand Down
2 changes: 1 addition & 1 deletion docs/_includes/reference/cli/werf_run.md
Expand Up @@ -14,7 +14,7 @@ werf run [options] [IMAGE_NAME] [-- COMMAND ARG...]
{{ header }} Examples

```shell
# Run specified image
# Run specified image and remove after execution
$ werf run application

# Run image with predefined docker run options and command for debug
Expand Down

0 comments on commit c04367c

Please sign in to comment.