Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hello-world and hello-world@sha256:... are treated as different images #2061

Open
AkihiroSuda opened this issue Mar 1, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@AkihiroSuda
Copy link
Member

Description

hello-world and hello-world@sha256:... are treated as different images

Steps to reproduce the issue

$ nerdctl pull hello-world
docker.io/library/hello-world:latest:                                             resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb:    done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4: done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412:   done           |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54:    done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 5.3 s 

$ nerdctl image inspect hello-world@sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb
FATA[0000] 1 errors:
no such image: hello-world@sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb

$ nerdctl pull hello-world@sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb
docker.io/library/hello-world@sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb: resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb:                         done           |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4:                      done           |++++++++++++++++++++++++++++++++++++++| 
config-sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412:                        done           |++++++++++++++++++++++++++++++++++++++| 
elapsed: 1.9 s                                                                                         total:   0.0 B (0.0 B/s)

$ nerdctl image inspect hello-world@sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb
[
    {
        "Id": "sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412",
        "RepoTags": [
            "hello-world:"
        ],
        "RepoDigests": [
            "hello-world@sha256:6e8b6f026e0b9c419ea0fd02d3905dd0952ad1feea67543f525c73a0a790fefb"
        ],
        "Comment": "",
        "Created": "2021-09-23T23:47:57.442225064Z",
        "Author": "",
        "Config": {
            "AttachStdin": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/hello"
            ]
        },
        "Architecture": "amd64",
        "Os": "linux",
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:e07ee1baac5fae6a26f30cabfe54a36d3402f96afda318fe0a96cec4ca393359"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]

$ nerdctl images
REPOSITORY     TAG       IMAGE ID        CREATED               PLATFORM       SIZE        BLOB SIZE
hello-world    latest    6e8b6f026e0b    2 minutes ago         linux/amd64    20.0 KiB    6.9 KiB
hello-world    <none>    6e8b6f026e0b    About a minute ago    linux/amd64    20.0 KiB    6.9 KiB

Describe the results you received and expected

Received: hello-world and hello-world@sha256:... are treated as different images
Expected: should be treated as a single image

What version of nerdctl are you using?

v1.2.1

Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

Host information

No response

@AkihiroSuda AkihiroSuda added kind/unconfirmed-bug-claim Unconfirmed bug claim bug Something isn't working and removed kind/unconfirmed-bug-claim Unconfirmed bug claim labels Mar 1, 2023
@suyanhanx
Copy link
Contributor

#1802 It looks related to this issue.

ginglis13 added a commit to ginglis13/nerdctl that referenced this issue Mar 16, 2023
fixes containerd#2061

adds filters for walking images in the containerd store
to cover the case of <ref>@sha256:<digest>

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
@ginglis13
Copy link
Contributor

ginglis13 commented Mar 16, 2023

It looks like pull calls EnsureImage with "always" option:

_, err = EnsureImage(ctx, client, rawRef, ocispecPlatforms, "always", unpack, options.Quiet, options)

which will ignore a check for existing image:

// if not `always` pull and given one platform and image found locally, return existing image directly.
if mode != "always" && len(ocispecPlatforms) == 1 {
if res, err := GetExistingImage(ctx, client, snapshotter, rawRef, ocispecPlatforms[0]); err == nil {
return res, nil

what is meant by the PullMode values "always", "missing", and "never"?

// PullMode is either one of "always", "missing", "never"
type PullMode = string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants