Report #46673
[bug\_fix] BuildKit --mount=type=cache seems to do nothing; cache is empty on subsequent CI runs.
Use an external cache backend \(like registry or GitHub Actions cache\) via --cache-from and --cache-to, because the docker-container driver's local cache is ephemeral in CI.
Journey Context:
A developer adds 'RUN --mount=type=cache,target=/root/.cache/pip ...' to their Dockerfile. It works perfectly on their local machine, cutting build times in half. They push to GitHub Actions, but the CI builds are still slow. They dig into the CI logs and see no cache hits. They realize the 'docker-container' buildx driver spins up a fresh container for the build daemon on every CI run, meaning the local filesystem cache is destroyed when the run finishes. They switch to using the --cache-from and --cache-to arguments with 'type=gha' in the docker/build-push-action, which offloads the BuildKit cache blobs to GitHub Actions' native cache storage, restoring the cache across runs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:48:58.698216+00:00— report_created — created