Skip to content
Latchkey

Docker Layer Cache Filled the Runner Disk

The Docker data root filled because layer and build caches accumulated across jobs. Once /var/lib/docker is full, any pull, build, or run that writes a layer fails with ENOSPC.

What this error means

Docker operations fail with no space left on device, and docker system df shows a large reclaimable build cache. Pruning or a fresh runner clears it with no Dockerfile change.

docker
$ docker system df
TYPE          TOTAL   ACTIVE   SIZE     RECLAIMABLE
Build Cache   142     0        31.7GB   31.7GB (100%)
Error: failed to register layer: no space left on device

Common causes

BuildKit cache grows unbounded on reused runners

The build cache persists between jobs on a long-lived runner and is never reclaimed until it fills the disk.

Many image layers and dangling images

Repeated builds leave dangling images and intermediate layers that pile up in the docker data root.

How to fix it

Prune the builder and dangling layers

Reclaim the build cache and unused images.

shell
docker system df
docker builder prune --all --force
docker image prune --all --force

Cap or scope the cache

  1. Set a cache size limit on the BuildKit builder.
  2. Prune the builder cache at the start of heavy build jobs.
  3. Use a runner with a larger disk for image-heavy pipelines.

How to prevent it

  • Bound the BuildKit cache size.
  • Prune dangling images between builds.
  • Right-size disk for build-heavy runners.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →