Docker
devopsdockerReferenceIntermediate
docker system prune
Reclaim host disk space by removing all unused containers, networks, images, and build cache.
Verified: 2026-09-30
Tested on:docker 27.x
Platforms:
linuxmacoswindows
#docker#cleanup#disk#prune
Command
docker system prune -a --volumes -f
Short Description
docker system prune is the primary cleanup command in Docker. It removes stopped containers, unused networks, dangling images, and build caches to free up substantial gigabytes of disk space.
Syntax
docker system prune [OPTIONS]Examples
Standard Cleanup (Stopped containers + dangling images)
docker system pruneDeep Cleanup (All unused images + unreferenced volumes)
docker system prune --all --volumes --forceFlags & Options
| Flag | Shorthand | Description |
|---|---|---|
--all | -a | Remove all unused images, not just dangling ones. |
--volumes | Prune unused named volumes as well. | |
--force | -f | Do not prompt for interactive confirmation. |