This allows users to configure the buildkit GC.
The following enables the default GC:
```
{
"builder": {
"gc": {
"enabled": true
}
}
}
```
The default GC policy has a simple config:
```
{
"builder": {
"gc": {
"enabled": true,
"defaultKeepStorage": "30GB"
}
}
}
```
A custom GC policy can be used instead by specifying a list of cache prune rules:
```
{
"builder": {
"gc": {
"enabled": true,
"policy": [
{"keepStorage": "512MB", "filter": ["unused-for=1400h"]]},
{"keepStorage": "30GB", "all": true}
]
}
}
}
```
Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 4a776d0ca76c4bdf4399aef8c102361d6c2819eb)
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 73e2f72a7c5bd6d6f8306e0ffe4371e1c3b00a21
Component: engine
23 lines
676 B
Go
23 lines
676 B
Go
package config
|
|
|
|
import "github.com/docker/docker/api/types/filters"
|
|
|
|
// BuilderGCRule represents a GC rule for buildkit cache
|
|
type BuilderGCRule struct {
|
|
All bool `json:",omitempty"`
|
|
Filter filters.Args `json:",omitempty"`
|
|
KeepStorage string `json:",omitempty"`
|
|
}
|
|
|
|
// BuilderGCConfig contains GC config for a buildkit builder
|
|
type BuilderGCConfig struct {
|
|
Enabled bool `json:",omitempty"`
|
|
Policy []BuilderGCRule `json:",omitempty"`
|
|
DefaultKeepStorage string `json:",omitempty"`
|
|
}
|
|
|
|
// BuilderConfig contains config for the builder
|
|
type BuilderConfig struct {
|
|
GC BuilderGCConfig `json:",omitempty"`
|
|
}
|