Description
Images may be present in the local image cache without having been pushed and/or tagged ("dangling").
The new code unconditionally includes RepoDigests and RepoTags;
|
RepoDigests: []string{img.Name() + "@" + img.Target().Digest.String()}, // "hello-world@sha256:bfea6278a0a267fad2634554f4f0c6f31981eea41c553fdf5a83e95a41d40c38"}, |
|
RepoTags: []string{img.Name()}, |
But also assumes an image always has a single tag (which may not be the case, e.g. ubuntu:latest and ubuntu:22.04 may be the same image).
The old code accounts for this situation, and (for backward compatibility) returns <none>:<none> as name/tag;
|
if summary.RepoDigests == nil && summary.RepoTags == nil { |
|
if opts.All || len(i.imageStore.Children(id)) == 0 { |
|
|
|
if opts.Filters.Contains("dangling") && !danglingOnly { |
|
// dangling=false case, so dangling image is not needed |
|
continue |
|
} |
|
if opts.Filters.Contains("reference") { // skip images with no references if filtering by reference |
|
continue |
|
} |
|
summary.RepoDigests = []string{"<none>@<none>"} |
|
summary.RepoTags = []string{"<none>:<none>"} |
|
} else { |
|
continue |
|
} |
|
} else if danglingOnly && len(summary.RepoTags) > 0 { |
Description
Images may be present in the local image cache without having been pushed and/or tagged ("dangling").
The new code unconditionally includes
RepoDigestsandRepoTags;moby/daemon/containerd/image_list.go
Lines 59 to 60 in 98d8343
But also assumes an image always has a single tag (which may not be the case, e.g.
ubuntu:latestandubuntu:22.04may be the same image).The old code accounts for this situation, and (for backward compatibility) returns
<none>:<none>as name/tag;moby/daemon/images/image_list.go
Lines 152 to 167 in 7624f8a