Caching layers without a daemon in CI (Kaniko / Buildah)
A Docker daemon keeps a local layer cache between builds; daemonless builders start fresh each job. To reuse layers, Kaniko pushes them to a --cache-repo, and Buildah relies on a persisted storage directory or a registry cache. Without one, every job is a cold build.
What this error means
Daemonless builds take as long as a cold build every time, with no layer reuse, because there is no persistent daemon cache between CI jobs.
# Kaniko without a cache repo rebuilds every stage:
INFO[0010] No cached layer found for cmd RUN npm ci
INFO[0010] Unpacking rootfs as cmd COPY . . requires it.Common causes
No registry-backed cache configured
Daemonless tools do not share a local daemon cache; without --cache-repo (Kaniko) or a persisted store (Buildah), layers cannot be reused.
The storage directory is not persisted between jobs
Buildah's layer store lives on the ephemeral job filesystem; if it is not cached or mounted, it is discarded each run.
How to fix it
Use a registry cache for Kaniko
Enable --cache with a dedicated cache repo so layers persist across jobs in the registry.
/kaniko/executor --cache=true \
--cache-repo registry.example.com/app/cache \
--destination registry.example.com/app:latestPersist Buildah storage or layer cache
Cache the containers storage directory between jobs, or push/pull a cache image, so Buildah can reuse layers.
# GitLab: cache the buildah storage between jobs
cache:
key: buildah-store
paths:
- .local/share/containers/storageHow to prevent it
- Configure a registry cache repo for Kaniko builds.
- Persist Buildah storage or a cache image across CI jobs.
- Order Dockerfile layers so stable steps precede volatile ones.