Skip to content

containerd integration: verify RepoDigests, RepoTags works for untagged or multiple tags #43861

@thaJeztah

Description

@thaJeztah

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 {

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/imagesImage Distributioncontainerd-integrationIssues and PRs related to containerd integration

    Type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions