-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add podman system prune and info commands #2252
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
||
func pruneSystemCmd(c *cli.Context) error { | ||
|
||
runtime, err := adapter.GetRuntime(c) |
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.
bonus points for using the adapter.Runtime!
would really like some tests if that is possible |
cmd/podman/system_prune.go
Outdated
fmt.Println(cid) | ||
} | ||
} | ||
err1 := volumePrune(runtime, getContext(), c.Bool("force")) |
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.
I don't think docker system prune
actually prunes volumes. The description says exclusively containers, images, networks
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.
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.
There's a --volumes
flag.
b5c0f01
to
63017fd
Compare
/test images |
@vrothberg @mheon @baude @umohnani8 @giuseppe @TomSweeneyRedHat PTAL |
cmd/podman/system_prune.go
Outdated
err = pruneContainers(runtime, ctx, shared.Parallelize("rm"), c.Bool("force")) | ||
if c.Bool("volumes") { | ||
fmt.Println("Deleted Volumes") | ||
err1 := volumePrune(runtime, getContext()) |
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 be printing IDs here?
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.
volumePrune should print the ids that it is removing.
/test images |
LGTM |
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.
Nice PR! Just some minor comments regarding --force
and making the manpage and help message a bit clearer.
cmd/podman/system_prune.go
Outdated
pruneSystemFlags = []cli.Flag{ | ||
cli.BoolFlag{ | ||
Name: "all, a", | ||
Usage: "remove all unused data", |
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.
s/remove/Remove/ for consistency
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.
Fixed these all in the second patch.
} | ||
pruneSystemCommand = cli.Command{ | ||
Name: "prune", | ||
Usage: "Remove unused data", |
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.
"data" versus "systems"?
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.
Data is correct. systems was incorrect.
WARNING! This will remove: | ||
- all stopped containers%s | ||
- all dangling images | ||
- all 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.
Can we add - all volumes
if the flag is set?
cmd/podman/system_prune.go
Outdated
|
||
ctx := getContext() | ||
fmt.Println("Deleted Containers") | ||
err = pruneContainers(runtime, ctx, shared.Parallelize("rm"), c.Bool("force")) |
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.
s/err/errPruneContainers/
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.
I am not sure if we should use --force
here as it should only impact the cli prompt.
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.
Removed
cmd/podman/system_prune.go
Outdated
|
||
// Call prune; if any cids are returned, print them and then | ||
// return err in case an error also came up | ||
pruneCids, err1 := runtime.PruneImages(c.Bool("all")) |
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.
s/err1/err/PruneImages/ ... just to make the code easier to brain-parse
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.
Ok I changed to use lasterr to make it clearer.
docs/podman-system-prune.1.md
Outdated
@@ -0,0 +1,38 @@ | |||
% PODMAN(1) Podman Man Pages | |||
% Brent Baude | |||
% December 2018 |
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.
Copy artifact?
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.
Fixed
does not have any containers based on it. | ||
|
||
By default, volumes are not removed to prevent important data from being deleted if there is currently no container using the volume. Use the --volumes flag when running the command to prune volumes as well. | ||
|
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.
Can we define what we mean by systems (i.e., containers, images, build cache)? Same applies to the help message. Currently, it's hard to figure out which data is removed without actually running the command.
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.
This is a global replace issue. System should be Images
Fixed
bd4c286
to
fb8a731
Compare
LGTM |
cmd/podman/pod_unpause.go
Outdated
@@ -13,7 +13,7 @@ var ( | |||
podUnpauseFlags = []cli.Flag{ | |||
cli.BoolFlag{ | |||
Name: "all, a", | |||
Usage: "unpause all paused pods", | |||
Usage: "Anpause all paused pods", |
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.
s/Anpause/Unpause/
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.
Fixed
docs/podman-info.1.md
Outdated
@@ -1,9 +1,9 @@ | |||
% podman-version(1) |
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 this be podman-info?
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.
Yup, Fixed
@@ -1,9 +1,9 @@ | |||
% podman-version(1) | |||
|
|||
## NAME | |||
podman\-system\-info - Display system information |
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 this have it's own page, even if it's mostly a cut/paste job?
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.
No they are identical, This is what we do with all of the podman container commands
podman-container-ps -> podman-ps.
for example. I think we should add the alternate names to the linked images though.
docs/podman-system.1.md
Outdated
|
||
| Command | Man Page | Description | | ||
| ------- | --------------------------------------------------- | ---------------------------------------------------------------------------- | | ||
| info | [podman-system-info(1)](podman-system-info.1.md) | Displays Podman related system information. | |
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.
I don't think the podman-system-info.1.md exists and I don't see it in this PR.
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.
Fixed
@@ -162,6 +162,7 @@ the exit codes follow the `chroot` standard, see below: | |||
| [podman-start(1)](podman-start.1.md) | Starts one or more containers. | | |||
| [podman-stats(1)](podman-stats.1.md) | Display a live stream of one or more container's resource usage statistics. | | |||
| [podman-stop(1)](podman-stop.1.md) | Stop one or more running containers. | | |||
| [podman-system(1)](podman-system.1.md) | Manage podman. | |
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.
I think you should add podman-system-info and podman-system-prune here as well.
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.
We don't add any subcommands on the main man page?
podman container prune is not there so
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.
Any plans to implement podman system df
or podman system events
to match Docker? Even if they're no-ops?
Yes we need to add df and events, althoug podman-system-events is just another way of calling podman events, which also does not exist yet. |
☔ The latest upstream changes (presumably #2227) made this pull request unmergeable. Please resolve the merge conflicts. |
We are missing the equivalence of the docker system commands This patch set adds `podman system prune` and `podman system info` Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
We have no consistancy in out option usages and descritions on whether or not the first letter should be capatalized. This patch forces them all to be capatilized. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
/retest |
/test validate |
/lgtm |
We are missing the equivalence of the docker system commands
This patch set adds
podman system prune
Signed-off-by: Daniel J Walsh dwalsh@redhat.com