Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

daemon.json: configuring gc policies inconsistent with how = or == are required #5581

Open
rrauenza opened this issue Dec 9, 2024 · 1 comment

Comments

@rrauenza
Copy link

rrauenza commented Dec 9, 2024

I did this pull request,

docker/docs#21596

And I realized that my example wasn't actually working. The error messages out of the docker daemon seem to imply that maybe the code is adding ='s to the config before passing it on. It also seems like I am not allowed to break up these "type" filters into a list.

So this appears to be working:

 "filter": [
            "unused-for=48h","type=source.local,type==exec.cachemount,type==source.git.checkout"
          ],

Note that is type=, type==, type==

# docker buildx inspect
Name:   default
Driver: docker

Nodes:
Name:             default
Endpoint:         default
Status:           running
BuildKit version: v0.16.0
Platforms:        linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
Labels:
 org.mobyproject.buildkit.worker.moby.host-gateway-ip: 172.16.0.1
GC Policy rule#0:
 All:           false
 Filters:       type==source.local,type==exec.cachemount,type==source.git.checkout
 Keep Duration: 48h0m0.212245572s
 Keep Bytes:    8GiB

But this doesn't (daemon starts, but gc errors):

 "filter": [
            "unused-for=48h","type=source.local,type=exec.cachemount,type=source.git.checkout"
          ],

Note that is type=, type=, type=

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).pruneOnce\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/cache/manager.go:1030\ngithub.com/moby/buildkit/cache.(*cacheManager).Prune\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/cache/manager.go:1010\ngithub.com/docker/docker/builder/builder-next/worker.(*Worker).Prune\n\t/root/rpmbuild/BUILD/src/engine/builder/builder-next/worker/worker.go:295\ngithub.com/moby/buildkit/control.(*Controller).gc.(*Controller).gc.func2.func3\n\t/root/rpmbuild/BUILD/src/engine/vendor/github.com/moby/buildkit/control/control.go:594\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/root/rpmbuild/BUILD/src/engine/vendor/golang.org/x/sync/errgroup/errgroup.go:78\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1695"

This also doesn't work (daemon won't even start):

            "unused-for=48h","type=source.local","type=exec.cachemount","type=source.git.checkout"

I am guessing that the type=, type=, type= is expected to normally work, and that the internal parser code adds a '=' to the first =, but ignores the later ones in the strings.

@rrauenza
Copy link
Author

rrauenza commented Dec 9, 2024

# docker info
Client: Docker Engine - Community
 Version:    27.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.17.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.7
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant