summaryrefslogtreecommitdiff
path: root/pkg/domain/infra
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2020-09-08 12:22:53 +0200
committerValentin Rothberg <rothberg@redhat.com>2020-09-08 12:22:53 +0200
commitd3e05de1563436fdcfa656bb499be02e0f40282b (patch)
tree5520752a95cdf06f0f59b592a91ed2175710e539 /pkg/domain/infra
parentbe7778df6c70227dab760ea92637ed97dad29641 (diff)
downloadpodman-d3e05de1563436fdcfa656bb499be02e0f40282b.tar.gz
podman-d3e05de1563436fdcfa656bb499be02e0f40282b.tar.bz2
podman-d3e05de1563436fdcfa656bb499be02e0f40282b.zip
podman stop: do not cleanup for auto-removal
Do not perform a container clean up for containers configured for auto-removal (e.g., via `podman run --rm`). There is a small race window with the other process performing the removal where a clean up during podman-stop may fail since the container has already been removed and cleaned up. As the removing process will clean up the container, we don't have to do it during podman-stop. Fixes: #7384 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r--pkg/domain/infra/abi/containers.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 3fee5d394..0537942e6 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -174,6 +174,12 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
return err
}
}
+ if c.AutoRemove() {
+ // Issue #7384: if the container is configured for
+ // auto-removal, it might already have been removed at
+ // this point.
+ return nil
+ }
return c.Cleanup(ctx)
})
if err != nil {