Error Codes Wiki

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

  1. 1Check Docker disk usage: 'docker system df -v' to see detailed usage by images, containers, volumes
  2. 2Prune everything unused: 'docker system prune -a --volumes' (removes all unused images, containers, volumes, and networks)
  3. 3Prune selectively: 'docker image prune -a' (unused images), 'docker volume prune' (unused volumes), 'docker builder prune' (build cache)
  4. 4Remove specific large images: 'docker images --format "table {{.Repository}}\t{{.Size}}"' then 'docker rmi image-id'
  5. 5Move Docker data directory to a larger disk: edit /etc/docker/daemon.json with '"data-root": "/new/path"'

Tags

dockerdisk-spacepruneimagescleanup

More in Docker

Frequently 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.