summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/images.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/varlinkapi/images.go')
-rw-r--r--pkg/varlinkapi/images.go32
1 files changed, 31 insertions, 1 deletions
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go
index 1d46c5b71..333595a96 100644
--- a/pkg/varlinkapi/images.go
+++ b/pkg/varlinkapi/images.go
@@ -249,7 +249,7 @@ func (i *LibpodAPI) BuildImage(call iopodman.VarlinkCall, config iopodman.BuildI
c := make(chan error)
go func() {
- err := i.Runtime.Build(getContext(), options, newPathDockerFiles...)
+ _, _, err := i.Runtime.Build(getContext(), options, newPathDockerFiles...)
c <- err
close(c)
}()
@@ -450,6 +450,18 @@ func (i *LibpodAPI) TagImage(call iopodman.VarlinkCall, name, tag string) error
return call.ReplyTagImage(newImage.ID())
}
+// UntagImage accepts an image name and tag as strings and removes the tag from the local store.
+func (i *LibpodAPI) UntagImage(call iopodman.VarlinkCall, name, tag string) error {
+ newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
+ if err != nil {
+ return call.ReplyImageNotFound(name, err.Error())
+ }
+ if err := newImage.UntagImage(tag); err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ return call.ReplyUntagImage(newImage.ID())
+}
+
// RemoveImage accepts a image name or ID as a string and force bool to determine if it should
// remove the image even if being used by stopped containers
func (i *LibpodAPI) RemoveImage(call iopodman.VarlinkCall, name string, force bool) error {
@@ -465,6 +477,24 @@ func (i *LibpodAPI) RemoveImage(call iopodman.VarlinkCall, name string, force bo
return call.ReplyRemoveImage(newImage.ID())
}
+// RemoveImageWithResponse accepts an image name and force bool. It returns details about what
+// was done in removeimageresponse struct.
+func (i *LibpodAPI) RemoveImageWithResponse(call iopodman.VarlinkCall, name string, force bool) error {
+ ir := iopodman.RemoveImageResponse{}
+ ctx := getContext()
+ newImage, err := i.Runtime.ImageRuntime().NewFromLocal(name)
+ if err != nil {
+ return call.ReplyImageNotFound(name, err.Error())
+ }
+ response, err := i.Runtime.RemoveImage(ctx, newImage, force)
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ ir.Untagged = append(ir.Untagged, response.Untagged...)
+ ir.Deleted = response.Deleted
+ return call.ReplyRemoveImageWithResponse(ir)
+}
+
// SearchImages searches all registries configured in /etc/containers/registries.conf for an image
// Requires an image name and a search limit as int
func (i *LibpodAPI) SearchImages(call iopodman.VarlinkCall, query string, limit *int64, filter iopodman.ImageSearchFilter) error {