Docker No Space Left on Device — Disk Full from Images, Volumes, and Build Cache
Errordocker
Overview
Fix Docker 'no space left on device' errors caused by accumulated images, stopped containers, unused volumes, and build cache filling up disk space.
Key Details
- Docker stores images, containers, volumes, and build cache in /var/lib/docker by default
- Unused images, stopped containers, and dangling volumes accumulate over time
- Build cache from multi-stage builds and layer caching can consume significant space
- Docker uses overlay2 filesystem by default which shares layers between images efficiently
- The 'docker system df' command shows disk usage breakdown by type
Common Causes
- Old Docker images never cleaned up accumulating over months of pulls and builds
- Stopped containers with large log files consuming disk space
- Orphaned volumes from deleted containers still holding data
- Docker build cache growing from frequent image builds without pruning
Steps
- 1Check Docker disk usage: 'docker system df -v' to see detailed usage by images, containers, volumes
- 2Prune everything unused: 'docker system prune -a --volumes' (removes all unused images, containers, volumes, and networks)
- 3Prune selectively: 'docker image prune -a' (unused images), 'docker volume prune' (unused volumes), 'docker builder prune' (build cache)
- 4Remove specific large images: 'docker images --format "table {{.Repository}}\t{{.Size}}"' then 'docker rmi image-id'
- 5Move Docker data directory to a larger disk: edit /etc/docker/daemon.json with '"data-root": "/new/path"'
Tags
dockerdisk-spacepruneimagescleanup
More in Docker
linux-docker-common-errorsLinux Docker Common Errors — Container, Network & Volume Troubleshooting
Errorlinux-docker-container-errors-detailedDocker Container Errors — Exit Codes, OOMKilled, and Networking Issues
Errorlinux-container-permission-namespaceLinux Container Permission Errors — User Namespaces and Rootless Containers
Warninglinux-kubernetes-pod-crashloopbackoffKubernetes CrashLoopBackOff — Pod Restart Loop and Container Crash Debugging
Errorlinux-kubernetes-pod-imagepullbackoffKubernetes ImagePullBackOff — Container Image Download and Registry Errors
Errorlinux-docker-compose-network-errorDocker Compose Network Errors — Container Communication and DNS Resolution Failures
WarningFrequently Asked Questions
docker system prune removes stopped containers, dangling images, and unused networks. With -a, it also removes all unused images (not just dangling). With --volumes, it removes unused volumes. It never removes running containers or their volumes.