diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-02-21 05:25:40 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-03-08 13:55:45 -0500 |
commit | e9db60492261df38cbef04a03c2693547b7e107d (patch) | |
tree | 419f6f554ff5033eb3707d266d073d2d2a81b156 /libpod/runtime_img.go | |
parent | b386d23bf01a1f3b0a604468803189625ef7b902 (diff) | |
download | podman-e9db60492261df38cbef04a03c2693547b7e107d.tar.gz podman-e9db60492261df38cbef04a03c2693547b7e107d.tar.bz2 podman-e9db60492261df38cbef04a03c2693547b7e107d.zip |
allow the removal of storage images
Sometimes if the system crashes while an image is being pulled
containers/storage can get into a bad state. This PR allows the
user to call into container storage to remove the image.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/runtime_img.go')
-rw-r--r-- | libpod/runtime_img.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go index 6e1105b9e..abefca788 100644 --- a/libpod/runtime_img.go +++ b/libpod/runtime_img.go @@ -325,6 +325,15 @@ func (r *Runtime) LoadImageFromSingleImageArchive(ctx context.Context, writer io return "", errors.Wrapf(saveErr, "error pulling image") } +// RemoveImageFromStorage goes directly to storage and attempts to remove +// the specified image. This is dangerous and should only be done if libpod +// reports that image is not known. This call is useful if you have a corrupted +// image that was never fully added to the libpod database. +func (r *Runtime) RemoveImageFromStorage(id string) error { + _, err := r.store.DeleteImage(id, true) + return err +} + func getImageNames(images []*image.Image) string { var names string for i := range images { |