Docker Errors
devopsdockerTroubleshootingBeginner
Docker: no space left on device / Disk space issues
Fix no space left on device errors in Docker by cleaning dangling images, build caches, stopped containers, and unattached volumes.
Verified: 2026-09-30
Tested on:docker 27.x
Platforms:
linuxmacoswindows
#docker#disk#prune#storage#errors
Error Message
ERROR: failed to solve: failed to compute cache key: failed to copy: write /var/lib/docker/overlay2/...: no space left on deviceor
docker: Error response from daemon: mkdir /var/lib/docker/overlay2/...: no space left on device.Symptoms
docker build,docker pull, ordocker runfails withno space left on device.- Docker Desktop or host disk usage reaches 100%.
Why It Happens
Over time, Docker accumulates:
- Dangling images: Untagged intermediate layers from repeated builds (
<none>:<none>). - BuildKit cache: Gigabytes of cached build step results.
- Stopped containers: Preserved container layers with local logs and tmp files.
- Orphaned volumes: Unattached persistent data volumes.
Quick Fix (Reclaim Maximum Disk Space)
# Clean stopped containers, unused networks, dangling images, and build cache
docker system prune -a --volumes -f[!WARNING] The
--volumesflag deletes all volumes not attached to a currently running container. Ensure your database data is backed up before pruning volumes!
Step-by-Step Diagnostic and Clean Up
```bash
docker system df
``````bash
docker builder prune -a -f
``````bash
docker image prune -a -f
```Related Topics
Docker: Cannot connect to database from container (ECONNREFUSED / localhost)
Fix database connection errors from Docker containers caused by using localhost instead of bridge network service names or host.docker.internal.
Prisma Error P2002: Unique constraint failed
How to troubleshoot and fix Prisma error P2002 when attempting to insert or update a record with a duplicate unique field value.