Skip to content
Latchkey

docker container prune: Remove Stopped Containers

Remove every stopped container in one command.

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 usage

Terminal
docker container prune -f
docker container prune -f --filter "until=1h"

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.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →