diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-05-17 11:38:28 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-05-17 13:52:03 +0200 |
commit | 2a43fcf786a989862f732c829fa754b881cc8be7 (patch) | |
tree | d5efbedcdfde286fd85c4e1ad737891428dd7350 /cmd/podman/images/prune.go | |
parent | 3bdbe3ce969ac510b8d4ee44da4578da9fed659c (diff) | |
download | podman-2a43fcf786a989862f732c829fa754b881cc8be7.tar.gz podman-2a43fcf786a989862f732c829fa754b881cc8be7.tar.bz2 podman-2a43fcf786a989862f732c829fa754b881cc8be7.zip |
image prune: remove unused images only with `--all`
Fix a regression in `podman image prune` where unused images were
accidentally removed even when `--all=false`. Extend and partially
rewrite the e2e tests to make sure we're not regressing again in the
future.
Fixing the aforementioned issue revealed another issue in the default
prune filter. While prune should remove all "dangling" images (i.e.,
those without tag), it removed only "intermediate" ones; dangling images
without children. Remove the mistaken comment from the libimage
migration.
Also clarify the help message and man page.
Fixes: #10350
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'cmd/podman/images/prune.go')
-rw-r--r-- | cmd/podman/images/prune.go | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/cmd/podman/images/prune.go b/cmd/podman/images/prune.go index 8231e5c57..6849d5971 100644 --- a/cmd/podman/images/prune.go +++ b/cmd/podman/images/prune.go @@ -15,10 +15,8 @@ import ( ) var ( - pruneDescription = `Removes all unnamed images from local storage. - - If an image is not being used by a container, it will be removed from the system.` - pruneCmd = &cobra.Command{ + pruneDescription = `Removes dangling or unused images from local storage.` + pruneCmd = &cobra.Command{ Use: "prune [options]", Args: validate.NoArgs, Short: "Remove unused images", @@ -41,7 +39,7 @@ func init() { }) flags := pruneCmd.Flags() - flags.BoolVarP(&pruneOpts.All, "all", "a", false, "Remove all unused images, not just dangling ones") + flags.BoolVarP(&pruneOpts.All, "all", "a", false, "Remove all images not in use by containers, not just dangling ones") flags.BoolVarP(&force, "force", "f", false, "Do not prompt for confirmation") filterFlagName := "filter" |