Error fix · Developer errors

Docker "no space left on device": Find What Filled the Disk

Fix Docker "no space left on device" during pulls, builds and writes: check disk and inodes, run docker system df, prune safely and move the data root.

Error messageno space left on device

By SiteDownCheck Editorial · Updated October 14, 2026 · 4 min read

"no space left on device" means a write failed with the operating system error ENOSPC. With Docker it appears while pulling images, building, starting containers, or inside a running container that tries to write a file. Typical forms:

failed to register layer: Error processing tar file(exit status 1): write /usr/lib/x86_64-linux-gnu/libLLVM.so: no space left on device
ERROR: failed to solve: write /var/lib/docker/...: no space left on device
mkdir /var/lib/docker/overlay2/...: no space left on device

The disk is not always full of bytes. It can also be out of inodes, out of space in one mounted volume, or limited by a quota. Work through the checks in order.

Check in this order

  1. Bytes on the host: df -h for the filesystem that holds Docker's data (default /var/lib/docker).
  2. Inodes: df -i. Millions of tiny files can exhaust inodes while df -h shows free space.
  3. What Docker is using: docker system df.
  4. A specific container's logs or writable layer growing without bound.
  5. Docker Desktop's virtual disk, which has its own size limit separate from your laptop's free space.
df -h /var/lib/docker
df -i /var/lib/docker
docker system df
docker system df -v   # per-image, per-container, per-volume detail

docker system df splits usage into images, containers, local volumes and build cache, and shows how much is reclaimable. That tells you which prune command will actually help.

Free space safely

Start with the least destructive commands and read what each one will remove.

docker container prune          # stopped containers
docker image prune              # dangling images only
docker builder prune            # build cache
docker image prune -a           # every image not used by a container
docker system prune             # stopped containers, unused networks, dangling images, build cache

Volumes are the dangerous part, because they hold databases and uploads. Docker's own prune commands treat them separately, and docker system prune does not remove volumes unless you add --volumes. In recent releases docker volume prune removes only anonymous volumes unless you pass --all; check docker volume prune --help on your version before running it.

You can prune by age so you keep recent work:

docker image prune -a --filter "until=720h"
docker builder prune --filter "until=168h"

The usual culprits

Container logs

The default json-file log driver keeps logs forever with no rotation. Find large ones:

sudo du -sh /var/lib/docker/containers/*/*-json.log | sort -h | tail

Set rotation globally in /etc/docker/daemon.json, then restart the daemon (the setting applies to newly created containers):

{
  "log-driver": "json-file",
  "log-opts": { "max-size": "10m", "max-file": "3" }
}

Or per container with --log-opt max-size=10m --log-opt max-file=3.

Build cache and old images

CI hosts and build servers accumulate layers on every build. Schedule docker builder prune --filter until=168h and docker image prune -a --filter until=720h and watch the job with a cron monitor so you notice when cleanup stops running.

Large files written inside the container

Data written to a container's writable layer is lost when it is removed and bloats overlay2. Check with docker ps -s. Move persistent data to a volume or bind mount, and remove temp files in the same RUN step in a Dockerfile.

Inode exhaustion

If df -i shows 100 percent, find the directory with the most files, often a cache or session folder:

sudo find /var/lib/docker -xdev -printf '%h\n' | sort | uniq -c | sort -rn | head

Docker Desktop

On macOS and Windows, Docker runs in a VM with a disk image of a fixed maximum size. Open Settings, then Resources, and check the disk image size and usage. Pruning frees space inside the image. Depending on version, you may need to restart Docker Desktop or use its reclaim option before the host sees the space return.

Move Docker's data directory

If the root filesystem is simply too small, put Docker's data on a bigger disk. Stop Docker, copy the data, set data-root in /etc/docker/daemon.json, then start it:

sudo systemctl stop docker docker.socket
sudo rsync -aHAX /var/lib/docker/ /mnt/bigdisk/docker/
{ "data-root": "/mnt/bigdisk/docker" }

Start Docker and confirm with docker info | grep "Docker Root Dir". Keep the old directory until everything runs correctly.

After the fix

A full disk often takes services down in confusing ways: databases refuse writes, and sites return 500 errors. Check the site with the Website Health Check, alert on disk usage at around 80 percent, and keep an uptime monitor on the public URL.

Next steps

FAQ

Is docker system prune safe?

It removes stopped containers, unused networks, dangling images and build cache, but not volumes by default. Read the confirmation prompt, and avoid -a and --volumes on production hosts until you have checked.

Why does df show free space but Docker still fails?

You may be out of inodes (df -i), or Docker's data lives on a different filesystem or volume than the one you checked. Run df -h /var/lib/docker specifically.

Will pruning delete my database?

Not unless the data is in an unused volume and you prune volumes. Named volumes attached to any container are kept, but confirm with docker volume ls first.

How do I stop logs from filling the disk?

Set max-size and max-file in daemon.json or per container, and recreate containers so they pick up the setting.

Get notified when this fix updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.