Skip to main content
⚡ OpenDevDocs
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 device

or

docker: Error response from daemon: mkdir /var/lib/docker/overlay2/...: no space left on device.

Symptoms

  • docker build, docker pull, or docker run fails with no space left on device.
  • Docker Desktop or host disk usage reaches 100%.

Why It Happens

Over time, Docker accumulates:

  1. Dangling images: Untagged intermediate layers from repeated builds (<none>:<none>).
  2. BuildKit cache: Gigabytes of cached build step results.
  3. Stopped containers: Preserved container layers with local logs and tmp files.
  4. 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 --volumes flag 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
```

On this page