Without -f it prompts and stalls non-interactive CI - pass -f. It only removes stopped containers, so a still-running one survives; stop it first if you need a clean slate. Running disposable containers with --rm avoids the need for this entirely.
docker container prune deletes all stopped containers at once. This page covers the filter flags and using it for CI cleanup.
What it does?
docker container prune removes all containers in the exited/created state. It is the bulk equivalent of docker rm on each stopped container.
Common errors in CI?
Without -f it prompts and stalls non-interactive CI - pass -f. It only removes stopped containers, so a still-running one survives; stop it first if you need a clean slate. Running disposable containers with --rm avoids the need for this entirely.