diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-07-19 11:41:04 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-07-26 09:28:17 +0200 |
commit | 1b6423e9f172b6d2437011ef4504a8247728a73d (patch) | |
tree | 0ba7fccceb6b036ed5e49caec51ffeb9921234a8 /pkg/api/handlers | |
parent | ec5c7c1f6a1898dacddb6cc35802525c288b61ef (diff) | |
download | podman-1b6423e9f172b6d2437011ef4504a8247728a73d.tar.gz podman-1b6423e9f172b6d2437011ef4504a8247728a73d.tar.bz2 podman-1b6423e9f172b6d2437011ef4504a8247728a73d.zip |
refine dangling checks
By proxy by vendoring containers/common. Previously, a "dangling" image
was an untagged image; just a described in the Docker docs. The
definition of dangling has now been refined to an untagged image without
children to be compatible with Docker.
Further update a redundant image-prune test.
Fixes: #10998
Fixes: #10832
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r-- | pkg/api/handlers/types.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go index 3cc10d70f..af5878798 100644 --- a/pkg/api/handlers/types.go +++ b/pkg/api/handlers/types.go @@ -176,6 +176,11 @@ func ImageToImageSummary(l *libimage.Image) (*entities.ImageSummary, error) { } containerCount := len(containers) + isDangling, err := l.IsDangling(context.TODO()) + if err != nil { + return nil, errors.Wrapf(err, "failed to check if image %s is dangling", l.ID()) + } + is := entities.ImageSummary{ ID: l.ID(), ParentId: imageData.Parent, @@ -188,7 +193,7 @@ func ImageToImageSummary(l *libimage.Image) (*entities.ImageSummary, error) { Labels: imageData.Labels, Containers: containerCount, ReadOnly: l.IsReadOnly(), - Dangling: l.IsDangling(), + Dangling: isDangling, Names: l.Names(), Digest: string(imageData.Digest), ConfigDigest: "", // TODO: libpod/image didn't set it but libimage should |