Skip to content

Commit b0ea39e

Browse files
authored
Merge pull request #23618 from dvdksn/daemon-build-gc-config-update
build: update example gc configs
2 parents 0676768 + 04597ad commit b0ea39e

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

content/manuals/build/cache/garbage-collection.md

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,15 @@ default GC policies resolve to:
119119
"enabled": true,
120120
"policy": [
121121
{
122-
"keepStorage": "2.764GB",
122+
"reservedSpace": "2.764GB",
123+
"keepDuration": "48h",
123124
"filter": [
124-
"unused-for=48h",
125-
"type==source.local,type==exec.cachemount,type==source.git.checkout"
125+
"type=source.local,type=exec.cachemount,type=source.git.checkout"
126126
]
127127
},
128-
{ "keepStorage": "20GB", "filter": ["unused-for=1440h"] },
129-
{ "keepStorage": "20GB" },
130-
{ "keepStorage": "20GB", "all": true }
128+
{ "reservedSpace": "20GB", "keepDuration": ["1440h"] },
129+
{ "reservedSpace": "20GB" },
130+
{ "reservedSpace": "20GB", "all": true }
131131
]
132132
}
133133
}
@@ -140,6 +140,8 @@ is to adjust the `defaultKeepStorage` option:
140140
- Increase the limit if you feel like you think the GC is too aggressive.
141141
- Decrease the limit if you need to preserve space.
142142

143+
#### Custom GC policies in the Docker daemon configuration file
144+
143145
If you need even more control, you can define your own GC policies directly.
144146
The following example defines a more conservative GC configuration with the
145147
following policies:
@@ -153,19 +155,30 @@ following policies:
153155
"builder": {
154156
"gc": {
155157
"enabled": true,
156-
"defaultKeepStorage": "50GB",
157158
"policy": [
158-
{ "keepStorage": "0", "filter": ["unused-for=1440h"] },
159-
{ "keepStorage": "0" },
160-
{ "keepStorage": "100GB", "all": true }
159+
{ "reservedSpace": "50GB", "keepDuration": ["1440h"] },
160+
{ "reservedSpace": "50GB" },
161+
{ "reservedSpace": "100GB", "all": true }
161162
]
162163
}
163164
}
164165
}
165166
```
166167

167-
Policies 1 and 2 here set `keepStorage` to `0`, which means they'll fall back
168-
to the default limit of 50GB as defined by `defaultKeepStorage`.
168+
> [!NOTE]
169+
> In the Docker daemon configuration file, the "equals" operator in GC filters
170+
> is denoted using a single `=`, whereas BuildKit's configuration file uses
171+
> `==`:
172+
>
173+
> | `daemon.json` | `buildkitd.toml` |
174+
> |---------------------|----------------------|
175+
> | `type=source.local` | `type==source.local` |
176+
> | `private=true` | `private==true` |
177+
> | `shared=true` | `shared==true` |
178+
>
179+
> See [prune filters](/reference/cli/docker/buildx/prune/#filter) for
180+
> information about available GC filters. GC configuration in `daemon.json`
181+
> supports all filters except `mutable` and `immutable`.
169182
170183
### BuildKit configuration file
171184

@@ -288,3 +301,6 @@ when defining a GC policy you have two additional configuration options:
288301
pruned.
289302
- `filters`: Filters let you specify specific types of cache records that a GC
290303
policy is allowed to prune.
304+
305+
See [buildx prune filters](/reference/cli/docker/buildx/prune/#filter) for
306+
information about available GC filters.

0 commit comments

Comments
 (0)