Skip to content

docs: replace GHA local cache workaround with reset - #25977

Merged
dvdksn merged 1 commit into
docker:mainfrom
sunm2n:docs-gha-local-cache-reset
Aug 31, 2026
Merged

dvdksn merged 1 commit into
docker:mainfrom
sunm2n:docs-gha-local-cache-reset

Conversation

@sunm2n

@sunm2n sunm2n commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Note

Depends on #25976, which documents the reset parameter this example now
uses. Please merge that one first.

The local cache example carried a Move cache step to work around the cache
directory growing on every run, pointing at moby/buildkit#1896. That issue is
closed — moby/buildkit#6612 added a reset attribute to the local cache
exporter, and Buildx v0.35.0 is the first release to carry it.

This exports to the cache directory directly with reset=true and drops the
extra step.

Verification

Five runs exporting to the same directory, each with a changed layer:

Run without reset with reset=true
1 5 blobs, 1896 KB 5 blobs, 1896 KB
2 9 blobs, 1912 KB 5 blobs, 1896 KB
3 13 blobs, 1928 KB 5 blobs, 1896 KB
4 17 blobs, 1944 KB 5 blobs, 1896 KB
5 21 blobs, 1960 KB 5 blobs, 1896 KB

The cache still works after five reset cycles. Importing from that directory on
a fresh docker-container builder, with no local build cache to fall back on,
hit both layers and produced no import warnings.

cache-from and cache-to pointing at the same directory is fine here: the
import runs during the solve and the reset runs after it.

Version requirement

setup-buildx-action installs the latest Buildx when version is unset, so the
default setup meets this. The note states the requirement for anyone pinning an
older version.

Callout

Changed from a warning to a note. The growth is still worth mentioning, but it
has a supported fix now rather than being an open problem.

The local cache example used a Move cache step to work around the cache
directory growing on every run, citing moby/buildkit#1896. That issue is
closed: moby/buildkit#6612 added a reset attribute to the local cache
exporter, and Buildx v0.35.0 is the first release to carry it.

Export to the cache directory directly with reset=true instead. Measured
over five runs exporting to the same directory: without reset the store
grew from 5 to 21 blobs, with reset it stayed at 5, and importing from
it on a fresh builder still hit the cache.

The callout is now a note rather than a warning, since the growth has a
supported fix.

Signed-off-by: Sunmin Lee <134378502+sunm2n@users.noreply.github.com>
@sunm2n
sunm2n requested a review from dvdksn as a code owner August 31, 2026 04:21
@netlify

netlify Bot commented Aug 31, 2026

Copy link
Copy Markdown

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 302177e
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/6a95015526635e000857dbfd
😎 Deploy Preview https://deploy-preview-25977--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the area/build Relates to Dockerfiles or docker build command label Aug 31, 2026

@dvdksn dvdksn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excellent, thanks!

@dvdksn
dvdksn merged commit 6529867 into docker:main Aug 31, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Relates to Dockerfiles or docker build command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants