mirror of
https://github.com/containers/podman.git
synced 2025-10-15 10:16:28 +08:00
cleanup: add new --stopped-only option
The podman container cleanup process runs asynchronous and by the time it gets the lock it is possible another podman process already did the cleanup and then did a new init() to start it again. If the cleanup process gets the lock there it will cause very weird things. This can be observed in the remote start API as CI flakes. Fixes #23754 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -311,7 +311,9 @@ func CreateExitCommandArgs(storageConfig storageTypes.StoreOptions, config *conf
|
||||
command = append(command, "--module", module)
|
||||
}
|
||||
|
||||
command = append(command, []string{"container", "cleanup"}...)
|
||||
// --stopped-only is used to ensure we only cleanup stopped containers and do not race
|
||||
// against other processes that did a cleanup() + init() again before we had the chance to run
|
||||
command = append(command, []string{"container", "cleanup", "--stopped-only"}...)
|
||||
|
||||
if rm {
|
||||
command = append(command, "--rm")
|
||||
|
Reference in New Issue
Block a user