From ee782fcb70c3d0d8f656406d346a3972f3200c83 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 12 May 2022 17:00:44 -0400 Subject: Deleting an n use image should return conflict not system error Fixes: https://github.com/containers/podman/issues/14208 Signed-off-by: Daniel J Walsh --- pkg/api/handlers/compat/images_remove.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/api/handlers/compat/images_remove.go b/pkg/api/handlers/compat/images_remove.go index f45b38c66..35bcb36aa 100644 --- a/pkg/api/handlers/compat/images_remove.go +++ b/pkg/api/handlers/compat/images_remove.go @@ -52,7 +52,10 @@ func RemoveImage(w http.ResponseWriter, r *http.Request) { utils.ImageNotFound(w, name, errors.Wrapf(err, "failed to find image %s", name)) return } - + if errors.Cause(err) == storage.ErrImageUsedByContainer { + utils.Error(w, http.StatusConflict, errors.Wrapf(err, "image %s is in use", name)) + return + } utils.Error(w, http.StatusInternalServerError, err) return } -- cgit v1.2.3-54-g00ecf