Earthly "no space left on device" (BuildKit cache) in CI
BuildKit stores layers and its build cache on disk. On a CI runner with a small volume, the cache plus intermediate layers can exhaust the disk mid-build, and the failing step reports "no space left on device".
What this error means
A RUN step or an export fails with "write ...: no space left on device" or "failed to solve: ... no space left on device" partway through an otherwise valid build.
+build | error: failed to copy files: write /var/lib/buildkit/... : no space left on device
Error: solve: failed to solve: no space left on deviceCommon causes
The BuildKit cache grew past the disk
Cached layers accumulate across runs on a persistent daemon and are never pruned, filling the volume buildkitd writes to.
Large intermediate layers on a small runner
A hosted runner ships a modest disk; big base images and build outputs can exhaust it in a single run.
How to fix it
Prune the BuildKit cache
Reclaim space by pruning Earthly's cache before or between builds.
earthly prune --allFree disk and cap the cache
- Remove unused preinstalled tooling to reclaim runner space.
- Set a cache size limit so buildkitd evicts old layers.
- Prune between jobs on long-lived self-hosted daemons.
# limit the buildkit cache Earthly keeps
export EARTHLY_BUILDKIT_CACHE_SIZE_MB=20000
earthly pruneHow to prevent it
- Cap the BuildKit cache size so it self-evicts.
- Prune the cache on persistent self-hosted daemons.
- Use runners with enough disk for your base images.