Skip to content
FR
  1. LuzineDebug
  2. Docker & DevOps
  3. failed to register layer: Error processing tar f…
Docker & DevOps Intermediate ≈ 15 min to fix

Fix "no space left on device" (Docker and Linux)

Error message
failed to register layer: Error processing tar file(exit status 1): write /usr/lib/x86_64-linux-gnu/libLLVM-17.so.1: no space left on device
  • ERROR: failed to solve: failed to copy: write /var/lib/docker/buildkit/content/ingest/3b2f/data: no space left on device
  • write /var/lib/docker/tmp/GetImageBlob123456789: no space left on device
  • Error: ENOSPC: no space left on device, write
  • OSError: [Errno 28] No space left on device
  • cannot create temp file for here-document: No space left on device
In short

The file system being written to is full, in space or in inodes. With Docker it is almost always images, build cache and logs in /var/lib/docker: check with df -h and docker system df, then clean up with docker builder prune and docker image prune -a.

Be the first to confirm this fix

What this error means

This is the ENOSPC system error: the kernel refuses a write because the target partition has no free blocks left, or no inodes left (the maximum number of files). Docker stores images, layers, BuildKit cache, volumes and container logs in /var/lib/docker on Linux, or in the Docker Desktop VM’s virtual disk on macOS and Windows. A docker pull or docker build extracting large layers fails as soon as that space runs out, even if your main disk seems to have room.

Common causes

  1. Accumulated images and build cache: every build leaves intermediate layers and <none> (dangling) images.
  2. Container logs without rotation: the json-file driver writes without limit to /var/lib/docker/containers/*/*-json.log.
  3. Docker Desktop virtual disk full (macOS/Windows): the VM has a maximum size set in the settings.
  4. Inodes exhausted: df -h shows free space, but df -i shows 100% (millions of small files, node_modules, caches).
  5. Small dedicated partition: a separate, too small /var or /tmp (sometimes a RAM tmpfs), or large system journals.

Step-by-step fix

  1. Find the full partition

    Check space and inodes. Spot the line holding /var/lib/docker (or /) at 100%.

    bash
    df -h
    df -i
  2. Measure what Docker uses

    docker system df breaks down images, containers, volumes and build cache, with the reclaimable share (RECLAIMABLE).

    bash
    docker system df
    docker system df -v
  3. Clean up without touching data

    These commands remove build cache, stopped containers and unused images. They do not touch volumes. Avoid docker system prune -a --volumes unless you know what is inside: --volumes deletes unused volumes, so your local databases.

    bash
    docker builder prune
    docker container prune
    docker image prune -a
  4. Empty and cap container logs (Linux)

    Find large log files and empty them with truncate (not rm, the file is still open). Then cap the size in /etc/docker/daemon.json and restart Docker; the rule applies to containers created afterwards.

    bash
    sudo sh -c 'du -h /var/lib/docker/containers/*/*-json.log | sort -h | tail -5'
    sudo truncate -s 0 /var/lib/docker/containers/<id>/<id>-json.log
  5. Configure log rotation

    Content of /etc/docker/daemon.json, then sudo systemctl restart docker and recreate the containers (docker compose up -d --force-recreate).

    json
    {
      "log-driver": "json-file",
      "log-opts": {
        "max-size": "10m",
        "max-file": "3"
      }
    }
  6. Linux outside Docker: find what fills the disk

    Find the largest folders on the partition, then free systemd journals and the package cache. On macOS, replace --max-depth=1 with -d 1.

    bash
    sudo du -xh / --max-depth=1 2>/dev/null | sort -h | tail -10
    sudo journalctl --vacuum-size=200M
    sudo apt clean        # Debian/Ubuntu
  7. macOS / Windows: grow the Docker Desktop disk

    In Docker Desktop, open Settings > Resources > Advanced and raise the virtual disk limit, after the cleanup above. The Troubleshoot menu also offers "Clean / Purge data", which wipes all images and volumes: keep it as a last resort.

Did this fix work for you?

Confirm it in one click: it will rise for the next developers stuck on the same error.

Keep it from coming back

  • Enable log rotation in daemon.json as soon as a server is installed.
  • Schedule regular cleanup in CI and on runners: docker builder prune --filter until=72h -f and docker image prune -a --filter until=168h -f.
  • Use a .dockerignore (node_modules, .git, vendor) and multi-stage builds to keep images small.
  • On a server, put Docker’s data-root on a dedicated disk and monitor it (alert at 80%).

Frequently asked questions

Does docker system prune delete my volumes?

Not by default. It removes stopped containers, unused networks, dangling images and build cache. Volumes are only removed with --volumes, and -a also removes every image not used by a container.

df -h shows free space but I get "no space left on device", why?

Inodes are probably exhausted: check with df -i. The write may also target another partition (/tmp, /var) or the Docker Desktop virtual disk.

Can I just delete /var/lib/docker?

Not while Docker is running, and only if you accept losing all images, containers and volumes. Prefer the prune commands, which keep a consistent state.

Useful tools for this error

More Docker & DevOps errors

All Docker & DevOps errors →