docker system prune Explained
What docker system prune does, with an example.
Published November 9, 2026
docker system prune removes unused Docker data: stopped containers, unused networks, dangling images and build cache, freeing disk space.
How it works
Add -a to also remove all unused images and --volumes to remove unused volumes. Always read the confirmation prompt.
Use docker system df to see what is consuming space first.
Try it
docker system df
Images 12GB Containers 1GB Local Volumes 4GB Build Cache 6GB
docker system prune
Total reclaimed space: 7.4GB
Practical examples
Safe cleanup
docker system pruneAggressive including unused images
docker system prune -aInclude volumes (data loss risk)
docker system prune -a --volumesTargeted cleanup
docker image prune
docker builder pruneCommon mistakes
- Pruning volumes that hold database data.
- Running it on production without checking.
- Deleting images that must be re-downloaded.
Key takeaways
- docker system prune removes unused Docker data: stopped containers, unused networks, dangling images and build cache, freeing disk space.
- Run docker <command> --help for all options.
- Clean up unused resources regularly.
FAQ
What does it keep?
Running containers, used images, and volumes unless --volumes is given.
Where can I see all options?
Run the command with --help.