aboutsummaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorValentin Rothberg <vrothberg@redhat.com>2022-08-04 16:42:02 +0200
committerValentin Rothberg <vrothberg@redhat.com>2022-08-04 16:42:02 +0200
commit3102194f036b830bd5e242a67d04e238a4f50bc0 (patch)
treed6279e063562d5059bdc84d0e976a2e27c24b879 /vendor
parent4dff697b772bc3a99e6b1e9755f48c2a6194348c (diff)
downloadpodman-3102194f036b830bd5e242a67d04e238a4f50bc0.tar.gz
podman-3102194f036b830bd5e242a67d04e238a4f50bc0.tar.bz2
podman-3102194f036b830bd5e242a67d04e238a4f50bc0.zip
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>
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/containers/common/libimage/image.go9
-rw-r--r--vendor/github.com/containers/common/libimage/runtime.go3
-rw-r--r--vendor/github.com/containers/common/version/version.go2
-rw-r--r--vendor/modules.txt2
4 files changed, 12 insertions, 4 deletions
diff --git a/vendor/github.com/containers/common/libimage/image.go b/vendor/github.com/containers/common/libimage/image.go
index b1866fa9b..d1548eb23 100644
--- a/vendor/github.com/containers/common/libimage/image.go
+++ b/vendor/github.com/containers/common/libimage/image.go
@@ -470,6 +470,9 @@ func (i *Image) removeRecursive(ctx context.Context, rmMap map[string]*RemoveIma
}
if _, err := i.runtime.store.DeleteImage(i.ID(), true); handleError(err) != nil {
+ if errors.Is(err, storage.ErrImageUsedByContainer) {
+ err = fmt.Errorf("%w: consider listing external containers and force-removing image", err)
+ }
return processedIDs, err
}
report.Untagged = append(report.Untagged, i.Names()...)
@@ -478,6 +481,11 @@ func (i *Image) removeRecursive(ctx context.Context, rmMap map[string]*RemoveIma
report.Removed = true
}
+ // Do not delete any parents if NoPrune is true
+ if options.NoPrune {
+ return processedIDs, nil
+ }
+
// Check if can remove the parent image.
if parent == nil {
return processedIDs, nil
@@ -495,7 +503,6 @@ func (i *Image) removeRecursive(ctx context.Context, rmMap map[string]*RemoveIma
if !danglingParent {
return processedIDs, nil
}
-
// Recurse into removing the parent.
return parent.removeRecursive(ctx, rmMap, processedIDs, "", options)
}
diff --git a/vendor/github.com/containers/common/libimage/runtime.go b/vendor/github.com/containers/common/libimage/runtime.go
index 6030a179b..7cbf9c95e 100644
--- a/vendor/github.com/containers/common/libimage/runtime.go
+++ b/vendor/github.com/containers/common/libimage/runtime.go
@@ -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
diff --git a/vendor/github.com/containers/common/version/version.go b/vendor/github.com/containers/common/version/version.go
index 7b44a84fc..34e9fe6ba 100644
--- a/vendor/github.com/containers/common/version/version.go
+++ b/vendor/github.com/containers/common/version/version.go
@@ -1,4 +1,4 @@
package version
// Version is the version of the build.
-const Version = "0.49.1-dev"
+const Version = "0.49.2-dev"
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 2a1beb611..1a13785eb 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -114,7 +114,7 @@ github.com/containers/buildah/pkg/rusage
github.com/containers/buildah/pkg/sshagent
github.com/containers/buildah/pkg/util
github.com/containers/buildah/util
-# github.com/containers/common v0.49.1-0.20220729221035-246800047d46
+# github.com/containers/common v0.49.2-0.20220804143628-dc97077782d5
## explicit
github.com/containers/common/libimage
github.com/containers/common/libimage/define