GitLab CI "no space left on device" (Runner Disk Full)
By Kaveh Alemi·Latchkey
A step failed because the runner ran out of disk. Accumulated Docker images, caches, build outputs, or artifacts filled the volume mid-job.
What this error means
A build, checkout, or artifact step dies with "no space left on device" / "write error: No space left on device". It often starts intermittently on a busy runner and worsens over time.
gitlab-ci
tar:write error: No space left on deviceERROR:Job failed: exit code 2# orfailed to register layer:write /usr/lib/...: no space left on device
Common causes
Runner host disk filled
Long-lived runners accumulate dangling Docker images, build caches, and old artifacts until the volume is full. The next job fails on the first large write.
A single job writes too much
A job that unpacks huge images, generates large build outputs, or downloads big datasets can exhaust even a freshly cleaned disk.
How to fix it
Reclaim disk on the runner host
Prune unused Docker data and stale build directories.
Runner host
docker system prune -af --volumes
df -h
# remove old build dirs under the runner's builds_dir if safe
Reduce per-job footprint
Use smaller base images and multi-stage builds to shrink layers.
Limit cache and artifact sizes; expire old artifacts sooner.
Schedule periodic cleanup, or use ephemeral runners that start with a clean disk.
How to prevent it
Run docker system prune on a schedule for long-lived runners.
Prefer ephemeral runners that reset disk between jobs.
Keep cache and artifact sizes bounded with short expiry.
Frequently asked questions
What causes ""no space left on device""?
Long-lived runners accumulate dangling Docker images, build caches, and old artifacts until the volume is full. The next job fails on the first large write.
How do I fix "no space left on device"?
Prune unused Docker data and stale build directories.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.