mirror of
https://github.com/containers/podman.git
synced 2025-10-16 18:53:19 +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:
@ -53,6 +53,11 @@ func init() {
|
||||
|
||||
flags.BoolVar(&cleanupOptions.Remove, "rm", false, "After cleanup, remove the container entirely")
|
||||
flags.BoolVar(&cleanupOptions.RemoveImage, "rmi", false, "After cleanup, remove the image entirely")
|
||||
|
||||
stoppedOnlyFlag := "stopped-only"
|
||||
flags.BoolVar(&cleanupOptions.StoppedOnly, stoppedOnlyFlag, false, "Only cleanup when the container is in the stopped state")
|
||||
_ = flags.MarkHidden(stoppedOnlyFlag)
|
||||
|
||||
validate.AddLatestFlag(cleanupCommand, &cleanupOptions.Latest)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user