diff options
author | baude <bbaude@redhat.com> | 2019-01-10 14:39:39 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-01-10 15:21:42 -0600 |
commit | 7459c48863acea8453e0800124006a90ca82f646 (patch) | |
tree | a1c7ca5130f2f1cf496678a892d374d36b3e4c6a /pkg/varlinkapi | |
parent | 36d96c19f947aeac2675afe64a3b482e54f9e4c4 (diff) | |
download | podman-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 'pkg/varlinkapi')
-rw-r--r-- | pkg/varlinkapi/images.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go index 8f8934025..4a4f20031 100644 --- a/pkg/varlinkapi/images.go +++ b/pkg/varlinkapi/images.go @@ -620,3 +620,21 @@ func (i *LibpodAPI) ContainerRunlabel(call iopodman.VarlinkCall, input iopodman. } return call.ReplyContainerRunlabel() } + +// ImagesPrune .... +func (i *LibpodAPI) ImagesPrune(call iopodman.VarlinkCall) error { + var ( + pruned []string + ) + pruneImages, err := i.Runtime.ImageRuntime().GetPruneImages() + if err != nil { + return err + } + for _, i := range pruneImages { + if err := i.Remove(true); err != nil { + return call.ReplyErrorOccurred(err.Error()) + } + pruned = append(pruned, i.ID()) + } + return call.ReplyImagesPrune(pruned) +} |