Skip to content

Conversation

@dvdksn
Copy link
Contributor

@dvdksn dvdksn commented Oct 27, 2025

Signed-off-by: David Karlsson 35727626+dvdksn@users.noreply.github.com

- What I did

Updated the example builder gc config in the dockerd reference to use the new
options introduced in buildkit v0.17.

- How I did it

Tested manually

A couple small inconsistencies I noticed when doing this:

  • The filter field in daemon.json uses a single = to assign filters, whereas builder uses ==, for example: type==source.git.checkout
  • The size values in daemon.json are human-readable bytes. But BuildKit also allows percentage values. Attempting to set eg "minFreeSpace": "20%" results in config parse error.

- A picture of a cute animal (not mandatory but encouraged)

Screenshot 2025-10-27 at 14 43 05

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@dvdksn dvdksn requested review from a team and thaJeztah as code owners October 27, 2025 13:47
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment on lines +1081 to 1084
{ "maxUsedSpace": "512MB", "keepDuration": "48h", "filter": [ "type=source.local" ] },
{ "reservedSpace": "10GB", "maxUsedSpace": "100GB", "keepDuration": "1440h" },
{ "reservedSpace": "50GB", "minFreeSpace": "20GB", "maxUsedSpace": "200GB", "all": true }
]
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps @crazy-max or @jsternberg can help review 😅

These options always confuse me (e.g. in this case maxUsedSpace being 512MB, but other options having a larger size).

The filter field in daemon.json uses a single = to assign filters, whereas builder uses ==, for example: type==source.git.checkout

Is that something that should be aligned? I also recall the "single filter allowed" part on the daemon, and was confused by that (i.e., the daemon disallows multiple filters, but I couldn't find why it added that restriction); moby/moby#46864

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think alignment would be great. I see no reason that the formats should be separate. Also for the size values.

Copy link
Member

@crazy-max crazy-max Oct 27, 2025

Choose a reason for hiding this comment

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

Was looking at related PR on moby moby/moby#48720 and your changes look good to me.

We should also update https://docs.docker.com/build/cache/garbage-collection/#docker-daemon-configuration-file and on this page we show filters with == in some cases:

{
  "builder": {
    "gc": {
      "enabled": true,
      "policy": [
        {
          "keepStorage": "2.764GB",
          "filter": [
            "unused-for=48h",
            "type==source.local,type==exec.cachemount,type==source.git.checkout"
          ]
        },
        { "keepStorage": "20GB", "filter": ["unused-for=1440h"] },
        { "keepStorage": "20GB" },
        { "keepStorage": "20GB", "all": true }
      ]
    }
  }
}

I recall I made some changes in our buildx docs for the available filters: docker/buildx#3392. We define the operators = for equality, != for not equal and ~= for a regular expression.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I will update there to use the new properties and correct delimiter as well 👍🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Really nice filter addition to the docs btw ❤️

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

Successfully merging this pull request may close these issues.

4 participants