Skip to content

Update garbage-collection.md#24312

Open
brofids wants to merge 1 commit intodocker:mainfrom
brofids:patch-1
Open

Update garbage-collection.md#24312
brofids wants to merge 1 commit intodocker:mainfrom
brofids:patch-1

Conversation

@brofids
Copy link
Copy Markdown

@brofids brofids commented Mar 9, 2026

Using the filter suggested by the docs causing error in Docker 29.2.1 preventing GC from working.
Docs: https://docs.docker.com/build/cache/garbage-collection/#docker-daemon-configuration-file

Solution:

  • Appending double equals (==) fix the problem.
    type=source.local,type==exec.cachemount,type==source.git.checkout

Related error log:
Mar 09 14:39:58 gitRunner04 dockerd[1238772]: time="2026-03-09T14:39:58.005793998+07:00" level=error msg="gc error: filters: parse error: [type==source.local,type >|=|< exec.cachemount,type=source.git.checkout]: unsupported operator "=": invalid argument\nfailed to parse prune filters [type==source.local,type=exec.cachemount,type=source.git.checkout]\ngithub.com/moby/buildkit/cache.(*cacheManager).prune\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/cache/manager.go:1039\ngithub.com/moby/buildkit/cache.(*cacheManager).Prune\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/cache/manager.go:1019\ngithub.com/moby/buildkit/worker/base.(*Worker).Prune\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/worker/base/worker.go:507\ngithub.com/moby/buildkit/control.(*Controller).gc.func2\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/control/control.go:656\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/root/rpmbuild/BUILD/src/engine/vendor/golang.org/x/sync/errgroup/errgroup.go:93\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1693"

Description

Related issues or tickets

Reviews

  • Technical review
  • Editorial review
  • Product review

Using the filter suggested by the docs causing error in Docker 29.2.1 preventing GC from working.

Appending double equals (==) fix the problem.

Mar 09 14:39:58 gitRunner04 dockerd[1238772]: time="2026-03-09T14:39:58.005793998+07:00" level=error msg="gc error: filters: parse error: [type==source.local,type >|=|< exec.cachemount,type=source.git.checkout]: unsupported operator \"=\": invalid argument\nfailed to parse prune filters [type==source.local,type=exec.cachemount,type=source.git.checkout]\ngithub.com/moby/buildkit/cache.(*cacheManager).prune\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/cache/manager.go:1039\ngithub.com/moby/buildkit/cache.(*cacheManager).Prune\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/cache/manager.go:1019\ngithub.com/moby/buildkit/worker/base.(*Worker).Prune\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/worker/base/worker.go:507\ngithub.com/moby/buildkit/control.(*Controller).gc.func2\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/control/control.go:656\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/root/rpmbuild/BUILD/src/engine/vendor/golang.org/x/sync/errgroup/errgroup.go:93\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1693"
@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 9, 2026

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 08816c5
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/69ae7f7c1642d4000886650e
😎 Deploy Preview https://deploy-preview-24312--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 Mar 9, 2026
@brofids brofids marked this pull request as ready for review March 24, 2026 07:50
@brofids brofids requested a review from dvdksn as a code owner March 24, 2026 07:50
@dvdksn
Copy link
Copy Markdown
Contributor

dvdksn commented Mar 24, 2026

Did you set this policy in daemon.json or buildkitd.toml?

The format for these filter opts is, confusingly, slightly different. Daemon.json uses a single = whereas buildkitd.toml uses ==. (Or at least that was the case at the time of writing this.) This is explained by the note in the same document:
image

This particular example is just meant to show what the gc policies resolve to in the daemon.json format, for the default builder GC configuration in Docker Desktop.

https://docs.docker.com/build/cache/garbage-collection/#custom-gc-policies-in-the-docker-daemon-configuration-file

@brofids
Copy link
Copy Markdown
Author

brofids commented Mar 24, 2026

I set the policy in the daemon.json and tried single equal sign as the docs tell but got error message as attached above.
You can try to reproduce that on your machine.

On mine I ended up using mixed sign like below to get the garbage collection running,
type=source.local,type==exec.cachemount,type==source.git.checkout

Maybe the root cause happen somewhere inside the docker's code, but in the mean time it's necessary to update the docs so people know how to make the garbage collection working.

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