Docker · tool · fg-0258

Docker layer cache with type=gha never hits when one workflow builds several images

If you see Every run rebuilds from the first RUN step although cache-from type=gha is set, the cause and the fix for Docker are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
Every run rebuilds from the first RUN step although cache-from type=gha is setEarlier stages of a multi-stage build are always rebuilt
Cause
The gha backend writes every image to one default scope named buildkit, so each export overwrites the previous image's cache. The default min mode also caches only layers of the final stage.
Fix
Give each image its own scope and export with mode=max.
Apply
cache-from: type=gha,scope=api cache-to: type=gha,scope=api,mode=max
Affected
BuildKit gha cache backend, as of October 2026
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun