P2
Disk Space Exhausted — Docker Troubleshooting Guide
Reclaim disk space consumed by unused Docker images, volumes, and build cache. Covers safe incremental cleanup and emergency full prune.
10 min8 steps
Progress: 0/8 steps
0%
Get a breakdown of space used by Docker objects.
docker system df -v | head -40
Expected: Shows space used by images, containers, volumes, and build cache with RECLAIMABLE column.
Delete all stopped containers that are no longer needed.
docker container prune -f
Expected: List of removed containers and total reclaimed space.
Remove untagged images left over from builds.
docker image prune -f
Expected: List of removed images. These are safe to remove — they're not used by any container.
Remove all images not associated with a running container.
docker image prune -a -f
Expected: All unused images removed. Space reclaimed shown in output.
This removes ALL images not used by running containers. You'll need to re-pull them next time.
Delete volumes not attached to any container.
docker volume prune -f
Expected: Unused volumes deleted. WARNING: Data in those volumes is permanently lost.
This permanently deletes data in unused volumes. Make sure no stopped containers need them. Back up first if unsure.
Remove the Docker build cache.
docker builder prune -f
Expected: Build cache cleared. Subsequent builds may be slower.
Remove ALL unused Docker objects in one command.
docker system prune -a --volumes -f
Expected: All unused Docker objects removed. Maximum space reclaimed.
This removes ALL stopped containers, ALL unused images, ALL unused volumes, and ALL build cache. Only use if you're sure.
Check disk usage after cleanup.
docker system df && echo '---' && df -h /var/lib/docker
Expected: Docker should show much less space used. /var/lib/docker should have more free space.