Skip to main content
DevOps & Docker · Developer Error Resolution Lab

Fix Docker Error: 'write /var/lib/docker/...: no space left on device'

Clean dangling Docker build caches, unused volumes, and stopped containers to free disk space.

Triggered Error Message:

ERROR: failed to solve: failed to register layer: write /var/lib/docker/overlay2/...: no space left on device

# Step 1: Inspect Docker disk usage:
docker system df

# Step 2: Prune build cache (often releases 20GB+):
docker builder prune -a -f

# Step 3: Complete purge of all unused containers, images, and volumes:
docker system prune --all --volumes -f

# Step 4: Check host disk space:
df -h

Root Cause & Mechanism Analysis

Why does this error occur?

Docker accumulated gigabytes of unpruned build cache, dangling intermediate image layers, stopped containers, and orphaned volumes.

Frequently Asked Questions

Will docker system prune delete my active running database volumes?
No, active volumes attached to currently running containers are preserved.
Browse All 35 Guides