New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add new builder
subcommand and implement builder prune
to prune build cache
#1292
Conversation
…uild cache. This patch adds a new builder subcommand to manage builds, allowing to add more builder-related commands in the future. Unfortunately `build` expects an argument so could not be used as a subcommand. This also implements `docker builder prune`, which is needed to prune the builder cache manually without having to call `docker system prune`. Today when relying on the legacy builder, users are able to list a set of images (used as build cache) based on time filters and delete them. This patch allows the same usecase and more (specifying storage size) when relying on the new builder. The behavior of the `--all` option on `system prune` is slightly modified with respect to build cache: without `--all`, all but internal/frontend cache is removed whereas with `--all`, it removes the entirety of buildkit's cache. This is similar to keeping non-dangling images by default and removing them if `--all` is specified. Signed-off-by: Tibor Vass <tibor@docker.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally looks good; we may have to add a markdown file to /docs/reference to add some more description of the command
fmt.Fprintln(dockerCli.Out(), "Total reclaimed space:", units.HumanSize(float64(report.SpaceReclaimed))) | ||
return nil | ||
}, | ||
Annotations: map[string]string{"version": "1.39"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we hide this command, based on if buildkit is enabled?
@@ -42,7 +43,7 @@ func newPruneCommand(dockerCli command.Cli) *cobra.Command { | |||
|
|||
flags := cmd.Flags() | |||
flags.BoolVarP(&options.force, "force", "f", false, "Do not prompt for confirmation") | |||
flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused images not just dangling ones") | |||
flags.BoolVarP(&options.all, "all", "a", false, "Remove all unused images not just dangling ones, as well as all internal build cache") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if --all
is not set, do we prune any build cache at all?
(thinking about slightly different phrasing)
@tiborvass needs conflict resolution |
WIP: this modifies vendor
This patch adds a new builder subcommand to manage builds, allowing to add more
builder-related commands in the future. Unfortunately
build
expects an argumentso could not be used as a subcommand.
This also implements
docker builder prune
, which is needed to prune the buildercache manually without having to call
docker system prune
.Today when relying on the legacy builder, users are able to list a set of images
(used as build cache) based on time filters and delete them. This patch allows the
same usecase and more (specifying storage size) when relying on the new builder.
The behavior of the
--all
option onsystem prune
is slightly modified withrespect to build cache: without
--all
, all but internal/frontend cache is removedwhereas with
--all
, it removes the entirety of buildkit's cache. This is similarto keeping non-dangling images by default and removing them if
--all
is specified.Signed-off-by: Tibor Vass tibor@docker.com