summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-03-13 12:52:12 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-03-13 20:26:56 +0100
commit17b60891b6a4ce4e5c0e8ddae1a2dd9490a0e0d8 (patch)
treeaa289963f15ea4374c7521418e217c9178d30564 /cmd
parent22fc5a3e57566326b96f465e69e5566598666841 (diff)
downloadpodman-17b60891b6a4ce4e5c0e8ddae1a2dd9490a0e0d8.tar.gz
podman-17b60891b6a4ce4e5c0e8ddae1a2dd9490a0e0d8.tar.bz2
podman-17b60891b6a4ce4e5c0e8ddae1a2dd9490a0e0d8.zip
rm: fix cleanup race
we fire the cleanup process asynchronously so we might race with a command like: podman run --rm --name foo ... && podman run --rm --name foo Fix it by ensuring the container is deleted before we exit. This will race with the "cleanup" process, but it is fine as one of the two commands will fail with ErrNoSuchCtr while the other succeeds. Closes: https://github.com/containers/libpod/issues/2619 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/run.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd/podman/run.go b/cmd/podman/run.go
index 130c5a32c..a92d5d3db 100644
--- a/cmd/podman/run.go
+++ b/cmd/podman/run.go
@@ -166,6 +166,10 @@ func runCmd(c *cliconfig.RunValues) error {
exitCode = int(ecode)
}
+ if c.IsSet("rm") {
+ runtime.RemoveContainer(ctx, ctr, false, true)
+ }
+
return nil
}