Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

tiborvass
Copy link
Collaborator

@tiborvass tiborvass commented Aug 15, 2018

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 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

…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>
Copy link
Member

@thaJeztah thaJeztah left a 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"},
Copy link
Member

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")
Copy link
Member

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)

@andrewhsu
Copy link
Contributor

@tiborvass needs conflict resolution

@tiborvass
Copy link
Collaborator Author

This is superseded by #1295 and #1327

@tiborvass tiborvass closed this Nov 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants