summaryrefslogtreecommitdiff
path: root/cmd/podman/images_prune.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-01-10 14:39:39 -0600
committerbaude <bbaude@redhat.com>2019-01-10 15:21:42 -0600
commit7459c48863acea8453e0800124006a90ca82f646 (patch)
treea1c7ca5130f2f1cf496678a892d374d36b3e4c6a /cmd/podman/images_prune.go
parent36d96c19f947aeac2675afe64a3b482e54f9e4c4 (diff)
downloadpodman-7459c48863acea8453e0800124006a90ca82f646.tar.gz
podman-7459c48863acea8453e0800124006a90ca82f646.tar.bz2
podman-7459c48863acea8453e0800124006a90ca82f646.zip
Add varlink support for prune
Add the ability to prune unused images using the varlink API. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/images_prune.go')
-rw-r--r--cmd/podman/images_prune.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/cmd/podman/images_prune.go b/cmd/podman/images_prune.go
index cb72a498f..06879e02d 100644
--- a/cmd/podman/images_prune.go
+++ b/cmd/podman/images_prune.go
@@ -1,8 +1,8 @@
package main
import (
+ "fmt"
"github.com/containers/libpod/cmd/podman/libpodruntime"
- "github.com/containers/libpod/cmd/podman/shared"
"github.com/pkg/errors"
"github.com/urfave/cli"
)
@@ -30,5 +30,16 @@ func pruneImagesCmd(c *cli.Context) error {
}
defer runtime.Shutdown(false)
- return shared.Prune(runtime.ImageRuntime())
+ pruneImages, err := runtime.ImageRuntime().GetPruneImages()
+ if err != nil {
+ return err
+ }
+
+ for _, i := range pruneImages {
+ if err := i.Remove(true); err != nil {
+ return errors.Wrapf(err, "failed to remove %s", i.ID())
+ }
+ fmt.Println(i.ID())
+ }
+ return nil
}