Removes stopped containers, unused networks, dangling images and the build cache in a single pass. The flags decide how much of your disk you get back — and how much you lose.
Reclaim disk on a machine where images and layers have accumulated. On CI agents this is usually the difference between a green build and "no space left on device".
--volumes deletes named volumes that are not attached to a running container. A stopped Postgres container counts as not running. Check `docker volume ls` first.
| Command | Stopped containers | Unused networks | Dangling images | All unused images | Build cache | Volumes |
|---|---|---|---|---|---|---|
system prune | yes | yes | yes | no | yes | no |
system prune -a | yes | yes | yes | yes | yes | no |
system prune -a --volumes | yes | yes | yes | yes | yes | yes |
Narrower tools: docker container prune, docker network prune, docker builder prune, docker image prune, docker volume prune.
Keep a build server tidy without touching recent images or any volumes.