podman rmi: improve error message for build containers

Improve the error message when attempting to remove an image that is in
use by an external/build container.  Prior, the error only indicated
that the image was in use but did not aid in resolving the issue.

Fixes: #15006
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2022-08-04 16:42:02 +02:00
parent 4dff697b77
commit 3102194f03
7 changed files with 18 additions and 10 deletions

View File

@ -608,6 +608,8 @@ type RemoveImagesOptions struct {
// much space was freed. However, computing the size of an image is
// comparatively expensive, so it is made optional.
WithSize bool
// NoPrune will not remove dangling images
NoPrune bool
}
// RemoveImages removes images specified by names. If no names are specified,
@ -653,7 +655,6 @@ func (r *Runtime) RemoveImages(ctx context.Context, names []string, options *Rem
toDelete := []string{}
// Look up images in the local containers storage and fill out
// toDelete and the deleteMap.
switch {
case len(names) > 0:
// prepare lookupOptions