@@ -9,17 +9,17 @@ Remove build cache
99
1010### Options
1111
12- | Name | Type | Default | Description |
13- | :------------------------| :---------| :--------| :-------------------------------------------------------|
14- | ` -a ` , ` --all ` | ` bool ` | | Include internal/frontend images |
15- | [ ` --builder ` ] ( #builder ) | ` string ` | | Override the configured builder instance |
16- | ` -D ` , ` --debug ` | ` bool ` | | Enable debug logging |
17- | ` --filter ` | ` filter ` | | Provide filter values (e.g., ` until=24h ` ) |
18- | ` -f ` , ` --force ` | ` bool ` | | Do not prompt for confirmation |
19- | ` --max-used-space ` | ` bytes ` | ` 0 ` | Maximum amount of disk space allowed to keep for cache |
20- | ` --min-free-space ` | ` bytes ` | ` 0 ` | Target amount of free disk space after pruning |
21- | ` --reserved-space ` | ` bytes ` | ` 0 ` | Amount of disk space always allowed to keep for cache |
22- | ` --verbose ` | ` bool ` | | Provide a more verbose output |
12+ | Name | Type | Default | Description |
13+ | :-------------------------------------- | :---------| :--------| :-------------------------------------------------------|
14+ | [ ` -a ` ] ( #all ) , [ ` --all ` ] ( #all ) | ` bool ` | | Include internal/frontend images |
15+ | [ ` --builder ` ] ( #builder ) | ` string ` | | Override the configured builder instance |
16+ | ` -D ` , ` --debug ` | ` bool ` | | Enable debug logging |
17+ | [ ` --filter ` ] ( #filter ) | ` filter ` | | Provide filter values |
18+ | ` -f ` , ` --force ` | ` bool ` | | Do not prompt for confirmation |
19+ | [ ` --max-used-space ` ] ( #max-used-space ) | ` bytes ` | ` 0 ` | Maximum amount of disk space allowed to keep for cache |
20+ | [ ` --min-free-space ` ] ( #min-free-space ) | ` bytes ` | ` 0 ` | Target amount of free disk space after pruning |
21+ | [ ` --reserved-space ` ] ( #reserved-space ) | ` bytes ` | ` 0 ` | Amount of disk space always allowed to keep for cache |
22+ | ` --verbose ` | ` bool ` | | Provide a more verbose output |
2323
2424
2525<!-- -MARKER_GEN_END-->
@@ -28,23 +28,88 @@ Remove build cache
2828
2929Clears the build cache of the selected builder.
3030
31- You can finely control what cache data is kept using:
31+ ## Examples
32+
33+ ### <a name =" all " ></a > Include internal/frontend images (--all)
34+
35+ The ` --all ` flag to allow clearing internal helper images and frontend images
36+ set using the ` #syntax= ` directive or the ` BUILDKIT_SYNTAX ` build argument.
37+
38+ ### <a name =" filter " ></a > Provide filter values (--filter)
39+
40+ You can finely control which cache records to delete using the ` --filter ` flag.
41+
42+ The filter format is in the form of ` <key><op><value> ` , known as selectors. All
43+ selectors must match the target object for the filter to be true. We define the
44+ operators ` = ` for equality, ` != ` for not equal and ` ~= ` for a regular
45+ expression.
46+
47+ Valid filter keys are:
48+ - ` until ` flag to keep records that have been used in the last duration time.
49+ Value is a duration string, e.g. ` 24h ` or ` 2h30m ` , with allowable units of
50+ ` (h)ours ` , ` (m)inutes ` and ` (s)econds ` .
51+ - ` id ` flag to target a specific image ID.
52+ - ` parents ` flag to target records that are parents of the
53+ specified image ID. Multiple parent IDs are separated by a semicolon (` ; ` ).
54+ - ` description ` flag to target records whose description is the specified
55+ substring.
56+ - ` inuse ` flag to target records that are actively in use and therefore not
57+ reclaimable.
58+ - ` mutable ` flag to target records that are mutable.
59+ - ` immutable ` flag to target records that are immutable.
60+ - ` shared ` flag to target records that are shared with other resources,
61+ typically images.
62+ - ` private ` flag to target records that are not shared.
63+ - ` type ` flag to target records by type. Valid types are:
64+ - ` internal `
65+ - ` frontend `
66+ - ` source.local `
67+ - ` source.git.checkout `
68+ - ` exec.cachemount `
69+ - ` regular `
70+
71+ Examples:
72+
73+ ``` console
74+ docker buildx prune --filter "until=24h"
75+ docker buildx prune --filter "description~=golang"
76+ docker buildx prune --filter "parents=dpetmoi6n0yqanxjqrbnofz9n;kgoj0q6g57i35gdyrv546alz7"
77+ docker buildx prune --filter "type=source.local"
78+ docker buildx prune --filter "type!=exec.cachemount"
79+ ```
3280
33- - The ` --filter=until=<duration> ` flag to keep images that have been used in
34- the last ` <duration> ` time .
81+ > [ !NOTE ]
82+ > Multiple ` --filter ` flags are ANDed together .
3583
36- ` <duration> ` is a duration string, e.g. ` 24h ` or ` 2h30m ` , with allowable
37- units of ` (h)ours ` , ` (m)inutes ` and ` (s)econds ` .
84+ ### <a name =" max-used-space " ></a > Maximum amount of disk space allowed to keep for cache (--max-used-space)
3885
39- - The ` --keep-storage=<size> ` flag to keep ` <size> ` bytes of data in the cache.
86+ The ` --max-used-space ` flag allows setting a maximum amount of disk space
87+ that the build cache can use. If the cache is using more disk space than this
88+ value, the least recently used cache records are deleted until the total
89+ used space is less than or equal to the specified value.
4090
41- ` <size> ` is a human-readable memory string, e.g. ` 128mb ` , ` 2gb ` , etc. Units
42- are case-insensitive.
91+ The value is specified in bytes. You can use a human-readable memory string,
92+ e.g. ` 128mb ` , ` 2gb ` , etc. Units are case-insensitive.
4393
44- - The ` --all ` flag to allow clearing internal helper images and frontend images
45- set using the ` #syntax= ` directive or the ` BUILDKIT_SYNTAX ` build argument.
94+ ### <a name =" min-free-space " ></a > Target amount of free disk space after pruning (--min-free-space)
4695
47- ## Examples
96+ The ` --min-free-space ` flag allows setting a target amount of free disk space
97+ that should be available after pruning. If the available disk space is less
98+ than this value, the least recently used cache records are deleted until
99+ the available free space is greater than or equal to the specified value.
100+
101+ The value is specified in bytes. You can use a human-readable memory string,
102+ e.g. ` 128mb ` , ` 2gb ` , etc. Units are case-insensitive.
103+
104+ ### <a name =" reserved-space " ></a > Amount of disk space always allowed to keep for cache (--reserved-space)
105+
106+ The ` --reserved-space ` flag allows setting an amount of disk space that
107+ should always be kept for the build cache. If the available disk space is less
108+ than this value, the least recently used cache records are deleted until
109+ the available free space is greater than or equal to the specified value.
110+
111+ The value is specified in bytes. You can use a human-readable memory string,
112+ e.g. ` 128mb ` , ` 2gb ` , etc. Units are case-insensitive.
48113
49114### <a name =" builder " ></a > Override the configured builder instance (--builder)
50115
0 commit comments