From 67f5e3413bbdca614f20042bf12b326f897a4b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Fri, 12 Dec 2025 11:16:01 +0100 Subject: [PATCH] image: Fix dangling image detection with graphdrivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The isDangling function was incorrectly identifying images as dangling when they had no RepoTags but had valid RepoDigests. This can occur when the graphdrivers are used instead of the containerd image store. An image should only be considered dangling if it has no RepoTags, regardless of whether it has RepoDigests. Signed-off-by: Paweł Gronowski --- cli/command/image/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/command/image/list.go b/cli/command/image/list.go index 40915b8924..7efaf8426d 100644 --- a/cli/command/image/list.go +++ b/cli/command/image/list.go @@ -177,7 +177,7 @@ func shouldUseTree(options imagesOptions) (bool, error) { // isDangling is a copy of [formatter.isDangling]. func isDangling(img image.Summary) bool { - if len(img.RepoTags) == 0 && len(img.RepoDigests) == 0 { + if len(img.RepoTags) == 0 { return true } return len(img.RepoTags) == 1 && img.RepoTags[0] == ":" && len(img.RepoDigests) == 1 && img.RepoDigests[0] == "@"