Skip to content
Latchkey

GitLab CI "no space left on device" - Runner Disk Exhausted

A write failed because the runner host or container ran out of disk. On long-lived runners this accumulates from cached layers, build dirs, and old artifacts that are never pruned.

What this error means

A step fails with "no space left on device" - often during checkout, dependency install, or docker build. It commonly affects one busy runner while others are fine, and clears after cleanup.

Job log
fatal: cannot create directory at 'node_modules': No space left on device
# or
write /var/lib/docker/tmp/...: no space left on device

Common causes

Build/cache buildup on a long-lived runner

Each job leaves caches and build directories. Without cleanup, a persistent runner’s disk slowly fills until writes fail.

Dangling Docker images and volumes

On a dind or socket runner, old layers, stopped containers, and anonymous volumes consume the bulk of the disk over time.

How to fix it

Reclaim disk on the runner

Runner host
docker system prune -af --volumes
sudo gitlab-runner cache-clear   # if using local cache
df -h

Prevent buildup automatically

  1. Schedule periodic docker system prune and cache cleanup on persistent runners.
  2. Prefer ephemeral runners (autoscaling/Kubernetes) that start with a clean disk.
  3. Set expire_in on artifacts and bound cache size so storage stays in check.

How to prevent it

  • Use ephemeral runners or schedule disk cleanup on persistent ones.
  • Prune Docker images/volumes regularly on dind hosts.
  • Cap cache size and set artifact expire_in.

Related guides

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