Docker Prune and Cleanup
Reclaim disk safely: prune images, builders, volumes, and networks.
- docker prune
- docker disk
- reclaim space
- builder prune
- system df
Docker Prune and Cleanup
Reclaim disk safely: prune images, builders, volumes, and networks.
Commands
| Command | What it does |
|---|---|
docker system df | See what eats disk |
docker image prune -a --filter "until=168h" | Remove images unused for a week |
docker builder prune -af | Clear the build cache |
docker volume prune | Delete unclaimed volumes (data loss!) |
docker system prune -af --volumes | Full reset: everything unused |
Example
docker system df
docker image prune -a --filter "until=168h"
docker builder prune -af
FAQ
Is prune dangerous?
image/builder prune is safe (rebuildable); volume prune deletes data — always back up databases first.
Why did disk fill overnight?
Usually runaway json-file logs; cap them with --log-opt max-size=10m max-file=3.
常见问题
Is prune dangerous?
image/builder prune is safe (rebuildable); volume prune deletes data — always back up databases first.
Why did disk fill overnight?
Usually runaway json-file logs; cap them with --log-opt max-size=10m max-file=3.
Docker
Docker Install and Setup
Verify the Docker engine, configure context, and check versions.
Docker Images
Pull, list, tag, inspect, and remove images confidently.
Docker Containers
Run, list, stop, and clean up containers in daily work.
Docker Run Options
The flags that matter: detach, ports, env, volumes, limits.