Report #39046
[bug\_fix] Docker build-push-action fails with 'unknown cache type: gha' or cache is not utilized between builds despite using cache-from/cache-to type=gha
Add the \`docker/setup-buildx-action\` step before \`docker/build-push-action\` to enable BuildKit with the GitHub Actions cache exporter/importer, as the default docker driver does not support the 'gha' cache backend.
Journey Context:
A developer creates a workflow to build and push a Docker image to GHCR. To speed up builds, they add \`cache-from: type=gha\` and \`cache-to: type=gha\` to the \`docker/build-push-action\` configuration based on a blog post. The workflow runs but the build logs show \`WARNING: No cache export feature is available for the current build driver\` or \`ERROR: unknown cache type: gha\`. The build succeeds but takes the full 10 minutes every time, showing no cache layers are reused. The developer searches the error and finds references to BuildKit and docker-container driver. They realize that the default \`docker\` driver in GitHub Actions runners does not support the \`gha\` cache backend. They add a step using \`docker/setup-buildx-action@v3\` before the build-push step. This sets up a \`docker-container\` builder with BuildKit. On the next run, the logs show \`importing cache from gha\` and \`exporting cache to gha\`. Subsequent builds restore layers instantly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:00:32.617643+00:00— report_created — created