aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-01 10:04:38 -0400
committerGitHub <noreply@github.com>2021-09-01 10:04:38 -0400
commitf5cfb0da29a8ab07836f5b71816e915e04d5850e (patch)
tree5a7cc5fce7dc7b97b838d3e5f88efaa1e74a5838
parent5c3369951573d2079eca0be7fdc40a96933ab977 (diff)
parenta55f595fe1b84edc20c68c10f264fab82e687364 (diff)
downloadpodman-f5cfb0da29a8ab07836f5b71816e915e04d5850e.tar.gz
podman-f5cfb0da29a8ab07836f5b71816e915e04d5850e.tar.bz2
podman-f5cfb0da29a8ab07836f5b71816e915e04d5850e.zip
Merge pull request #11388 from Luap99/stop-cleanup
podman stop always cleanup
-rw-r--r--pkg/domain/infra/abi/containers.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index 8b2a5bfae..ff34ec86b 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -173,13 +173,17 @@ 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
+ err = c.Cleanup(ctx)
+ if err != nil {
+ // Issue #7384 and #11384: If the container is configured for
+ // auto-removal, it might already have been removed at this point.
+ // We still need to to cleanup since we do not know if the other cleanup process is successful
+ if c.AutoRemove() && (errors.Is(err, define.ErrNoSuchCtr) || errors.Is(err, define.ErrCtrRemoved)) {
+ return nil
+ }
+ return err
}
- return c.Cleanup(ctx)
+ return nil
})
if err != nil {
return nil, err