summaryrefslogtreecommitdiff
path: root/cmd/podman/run.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2018-12-13 07:33:12 -0800
committerGitHub <noreply@github.com>2018-12-13 07:33:12 -0800
commite3a1a7efca7f64b125fcd4f627a871bc699b5888 (patch)
tree564e4e4030f644ead1cdf3a0607123cf7c142580 /cmd/podman/run.go
parentd8d3950dd3c2ca15ae32bc94e1bedc088a66a1d8 (diff)
parent9786542620afea96d5eee2d05b7e1dec38a8235d (diff)
downloadpodman-e3a1a7efca7f64b125fcd4f627a871bc699b5888.tar.gz
podman-e3a1a7efca7f64b125fcd4f627a871bc699b5888.tar.bz2
podman-e3a1a7efca7f64b125fcd4f627a871bc699b5888.zip
Merge pull request #1989 from baude/deletecontainerfailstart
failed containers with --rm should remove themselves
Diffstat (limited to 'cmd/podman/run.go')
-rw-r--r--cmd/podman/run.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/podman/run.go b/cmd/podman/run.go
index a4b5c918e..20cb85347 100644
--- a/cmd/podman/run.go
+++ b/cmd/podman/run.go
@@ -116,6 +116,11 @@ func runCmd(c *cli.Context) error {
if strings.Index(err.Error(), "permission denied") > -1 {
exitCode = 126
}
+ if c.IsSet("rm") {
+ if deleteError := runtime.RemoveContainer(ctx, ctr, true); deleteError != nil {
+ logrus.Errorf("unable to remove container %s after failing to start and attach to it", ctr.ID())
+ }
+ }
return err
}