summaryrefslogtreecommitdiff
path: root/libpod/runtime_img.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/runtime_img.go')
-rw-r--r--libpod/runtime_img.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index bc328d5b9..8d2c3a1d6 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -884,9 +884,11 @@ func (r *Runtime) RemoveImage(image *storage.Image, force bool) (string, error)
if len(image.Names) > 1 && !force {
return "", fmt.Errorf("unable to delete %s (must force) - image is referred to in multiple tags", image.ID)
}
- // If it is forced, we have to untag the image so that it can be deleted
- image.Names = image.Names[:0]
+ // If it is forced, we have to untag the image so that it can be deleted
+ if err = r.store.SetNames(image.ID, image.Names[:0]); err != nil {
+ return "", err
+ }
_, err = r.store.DeleteImage(image.ID, true)
if err != nil {
return "", err