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

Projects
None yet
5 participants
@tiborvass
Copy link
Contributor

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

Add new `builder` subcommand and implement `builder prune` to prune b…
…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>
@thaJeztah
Copy link
Member

left a comment

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"},

This comment has been minimized.

Copy link
@thaJeztah

thaJeztah Aug 16, 2018

Member

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

This comment has been minimized.

Copy link
@thaJeztah

thaJeztah Aug 16, 2018

Member

if --all is not set, do we prune any build cache at all?

(thinking about slightly different phrasing)

@andrewhsu

This comment has been minimized.

Copy link
Contributor

commented Aug 19, 2018

@tiborvass needs conflict resolution

@tiborvass

This comment has been minimized.

Copy link
Contributor Author

commented Nov 22, 2018

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
You can’t perform that action at this time.