docker cleaning
696a4edf0617153016f9e0d8โข
Perfect โ this output tells us exactly where your disk space is stuck ๐
๐ Whatโs going on
- Images: 36.28 GB total โ 33.66 GB reclaimable (92%)
- Build cache: 33.96 GB total โ 31.51 GB reclaimable
- Containers: all active โ (donโt touch)
- Volumes: all in use โ (donโt touch)
๐ You can safely free ~65 GB without breaking running containers.
โ SAFE cleanup (recommended for your state)
1๏ธโฃ Clear Docker build cache (BIGGEST win)
docker builder prune -a -f๐งน Frees ~31.5 GB
2๏ธโฃ Remove unused images (not used by running containers)
docker image prune -a -f๐งน Frees ~33.6 GB
โ Running containers will NOT be affected
โ Images used by active containers are kept
โ DO NOT run these (for now)
docker container prune # all containers are active
docker volume prune # all volumes are in use๐ Verify space freed
docker system df
df -hYou should see Docker usage drop dramatically.
๐ก๏ธ Extra safety check (optional)
See which images are actually in use:
docker ps --format "table {{.Image}}\t{{.Names}}"๐ Prevent this from happening again
Add a weekly cleanup cron (safe)
crontab -eAdd:
0 3 * * 0 docker builder prune -a -f && docker image prune -a -f๐ง Pro tip (important for Tamashani)
Since you deploy often:
- Use multi-stage Docker builds
- Avoid
latesttags - Clean build cache after CI/CD deploys
If you want, paste:
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}"Iโll tell you which images are bloated and how to slim them down ๐