mirror of
https://github.com/docker/cli.git
synced 2026-01-26 15:41:42 +03:00
image: Fix dangling image detection with graphdrivers
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 <pawel.gronowski@docker.com>
This commit is contained in:
@@ -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] == "<none>:<none>" && len(img.RepoDigests) == 1 && img.RepoDigests[0] == "<none>@<none>"
|
||||
|
||||
Reference in New Issue
Block a user