diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-03-13 12:52:12 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2019-03-13 20:26:56 +0100 |
commit | 17b60891b6a4ce4e5c0e8ddae1a2dd9490a0e0d8 (patch) | |
tree | aa289963f15ea4374c7521418e217c9178d30564 | |
parent | 22fc5a3e57566326b96f465e69e5566598666841 (diff) | |
download | podman-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>
-rw-r--r-- | cmd/podman/run.go | 4 |
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 } |