-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Description:
Currently, runc delete can only remove a single container by its ID. It would be convenient to have an option to delete all stopped containers at once, without manually iterating over container IDs.
Use case / scenario:
In environments where runc is used directly for batch container management, or in scenarios like runc#4853
In such high-volume situations, cleaning up stopped containers manually or one by one is not only cumbersome but also may exacerbate resource contention (e.g., DBus delays, cgroup lock contention).
Proposed solution:
Add a new flag to runc delete, e.g., --all-stopped, which deletes all containers in the stopped state.
The command should skip running containers and only clean up metadata and cgroups of stopped containers.
Reuse existing internal delete logic to ensure consistency.
Example usage:
Delete all stopped containers
runc delete --all-stopped or
runc delete -a
Benefits:
Simplifies cleanup of stopped containers in batch or high-volume environments
Avoids manually scripting runc delete for multiple containers
Keeps CLI consistent with the single-container delete semantics