aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/system_prune.go
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2019-03-15 17:41:03 -0400
committerPeter Hunt <pehunt@redhat.com>2019-04-16 11:23:18 -0400
commit0b34b4a59cf090a47a2a13cc4814954c497b3d49 (patch)
tree22e5185775ae83766d6911dd6b3d6b8376a976e1 /cmd/podman/system_prune.go
parenta2e9626d92dedb182a500c3a0f04dcc0499a6d54 (diff)
downloadpodman-0b34b4a59cf090a47a2a13cc4814954c497b3d49.tar.gz
podman-0b34b4a59cf090a47a2a13cc4814954c497b3d49.tar.bz2
podman-0b34b4a59cf090a47a2a13cc4814954c497b3d49.zip
Add podman pod prune
podman system prune would leave pods be, and not prune them if they were stopped. Fix this by adding a `podman pod prune` command that prunes stopped pods similarly to containers. Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'cmd/podman/system_prune.go')
-rw-r--r--cmd/podman/system_prune.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/cmd/podman/system_prune.go b/cmd/podman/system_prune.go
index 436d54823..14cb96941 100644
--- a/cmd/podman/system_prune.go
+++ b/cmd/podman/system_prune.go
@@ -59,6 +59,7 @@ func pruneSystemCmd(c *cliconfig.SystemPruneValues) error {
fmt.Printf(`
WARNING! This will remove:
- all stopped containers%s
+ - all stopped pods
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] `, volumeString)
@@ -77,9 +78,17 @@ Are you sure you want to continue? [y/N] `, volumeString)
}
defer runtime.Shutdown(false)
+ rmWorkers := shared.Parallelize("rm")
ctx := getContext()
fmt.Println("Deleted Containers")
- lasterr := pruneContainers(runtime, ctx, shared.Parallelize("rm"), false, false)
+ lasterr := pruneContainers(runtime, ctx, rmWorkers, false, false)
+ fmt.Println("Deleted Pods")
+ if err := prunePods(runtime, ctx, rmWorkers, true); err != nil {
+ if lasterr != nil {
+ logrus.Errorf("%q", lasterr)
+ }
+ lasterr = err
+ }
if c.Bool("volumes") {
fmt.Println("Deleted Volumes")
err := volumePrune(runtime, getContext())