From cf70580d56af3b44476d4ad2f6bbcb1a4c64fa9b Mon Sep 17 00:00:00 2001 From: Rich Rauenzahn Date: Mon, 9 Dec 2024 11:03:01 -0800 Subject: [PATCH 1/2] Add example that shows the stated "default" settings in json (also fix an errant . ) --- .../manuals/build/cache/garbage-collection.md | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/content/manuals/build/cache/garbage-collection.md b/content/manuals/build/cache/garbage-collection.md index d0b1e59b823..681a750cc4c 100644 --- a/content/manuals/build/cache/garbage-collection.md +++ b/content/manuals/build/cache/garbage-collection.md @@ -26,7 +26,7 @@ Depending on the [driver](../builders/drivers/_index.md) used by your builder in the garbage collection will use a different configuration file. If you're using the [`docker` driver](../builders/drivers/docker.md), garbage collection -can be configured in the [Docker Daemon configuration](/reference/cli/dockerd.md#daemon-configuration-file). +can be configured in the [Docker Daemon configuration](/reference/cli/dockerd.md#daemon-configuration-file) file: ```json @@ -94,3 +94,37 @@ GC Policy rule#3: > > `Keep Bytes` defaults to 10% of the size of the disk. If the disk size cannot > be determined, it uses 2GB as a fallback. + +The policies above can be represented in the [Docker Daemon configuration](/reference/cli/dockerd.md#daemon-configuration-file) file with the following json: + +``` +{ + "builder": { + "gc": { + "enabled": true, + "policy": [ + { + "filter": [ + "unused-for=48h", + "type=source.local,type=exec.cachemount,type=source.git.checkout" + ], + "keepStorage": "512MB" + }, + { + "filter": [ + "unused-for=1440h" + ], + "keepStorage": "26GB" + }, + { + "all": true, + "keepStorage": "26GB" + }, + { + "keepStorage": "26GB" + } + ] + } + } +} +``` From 39e6af49bb136cf12dd58080a38e9f9ff5b0189d Mon Sep 17 00:00:00 2001 From: Rich Rauenzahn Date: Mon, 9 Dec 2024 11:35:10 -0800 Subject: [PATCH 2/2] Add language hint to code markdown, add note about bug report, fix type =='s --- content/manuals/build/cache/garbage-collection.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/content/manuals/build/cache/garbage-collection.md b/content/manuals/build/cache/garbage-collection.md index 681a750cc4c..2e263378a31 100644 --- a/content/manuals/build/cache/garbage-collection.md +++ b/content/manuals/build/cache/garbage-collection.md @@ -97,7 +97,7 @@ GC Policy rule#3: The policies above can be represented in the [Docker Daemon configuration](/reference/cli/dockerd.md#daemon-configuration-file) file with the following json: -``` +```json { "builder": { "gc": { @@ -106,7 +106,7 @@ The policies above can be represented in the [Docker Daemon configuration](/refe { "filter": [ "unused-for=48h", - "type=source.local,type=exec.cachemount,type=source.git.checkout" + "type=source.local,type==exec.cachemount,type==source.git.checkout" ], "keepStorage": "512MB" }, @@ -128,3 +128,6 @@ The policies above can be represented in the [Docker Daemon configuration](/refe } } ``` +> [!NOTE] +> https://github.com/moby/buildkit/issues/5581 is currently opening asking why the second and third `type` +> in the filter requires two ='s.