Skip to content

nerdctl image ls myapp shows nothing for images without latest tag #5113

Closed

Description

@mloskot

Description

This report is a follow-up to the discussion I opened here

The command nerdctl image ls myapp, where myapp is repository only, does not find any images of myapp if there is no latest tag present for myapp. This behaviour is very different to one of the Docker client, e.g. docker image ls java. I suspect it is an unexpected behaviour or even a bug.

The current behaviour is due to the unconditional use of TagNameOnly which adds the default tag "latest" to a reference if it only has a repo name, from here:

  1. The referenceutil.Parse("myapp")  yields docker.io/library/myapp due to
    if tg, ok := ir.nn.(reference.Named); ok {
    ir.nn = reference.TagNameOnly(tg)
  2. The TagNameOnly unconditionally appends :latest in https://github.com/distribution/reference/blob/0965666a6ade2e06035fe352e38344be1e68951a/normalize.go#L248-L252
  3. The filter becomes name==docker.io/library/myapp:latest

It's possible that this implementation of the listOptions function:

parsedReference, err := referenceutil.Parse(args[0])
if err != nil {
return nil, err
}
filters = []string{fmt.Sprintf("name==%s", parsedReference)}

should be modified to something like this:

-               filters = []string{fmt.Sprintf("name==%s", parsedReference)}
+               if parsedReference.ExplicitTag != "" || parsedReference.Digest != (digest.Digest("")) {
+                       filters = []string{fmt.Sprintf("name==%s", parsedReference)}
+               } else {
+                       filters = []string{fmt.Sprintf("name~=^%s:", regexp.QuoteMeta(parsedReference.Name()))}
+               }

To work around the inconvenience of the current implementation users instead of the simple invocation of

nerdctl image ls myapp

have to apply the filter trick

nerdctl image ls --filter 'reference=myapp:*'

Steps to reproduce the issue

  1. Go to nerdctl image ls only lists images with tag latest #5110
  2. Follow the sequence of examples presented there

Describe the results you received and expected

Received results:

PS > nerdctl image ls myapp
REPOSITORY    TAG    IMAGE ID    CREATED    PLATFORM    SIZE    BLOB SIZE

Expected results:

PS > nerdctl image ls myapp
REPOSITORY                              TAG                               IMAGE ID        CREATED           PLATFORM         SIZE       BLOB SIZE
myapp                                   9.8-ltsc2022-0.1.0-dev.5011fb1    5e2b4a9d1b07    34 minutes ago    windows/amd64    11.91GB    2.113GB

What version of nerdctl are you using?

PS > nerdctl version
time="2026-07-30T21:53:56+01:00" level=warning msg="unable to determine runc version" error="exec: \"runc\": executable file not found in %PATH%"
Client:
 Version:       v2.3.4
 OS/Arch:       windows/amd64
 Git commit:    0ce88b9d78b13f0caebc59c6bb01885d7df24fba
 buildctl:
  Version:      v0.31.2
  GitCommit:    e42e1bfd389af7203238cce77b1f7dad447285e9

Server:
 containerd:
  Version:      v2.3.3
  GitCommit:    aad11006b869517fcd3009450b6f82da282e1a9b
 runc:
  Version:

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

None

Host information

Windows Server 2022 with containerd, buildkit and nerdctl

Activity

  1. added a commit that references this issue on Aug 1, 2026
    00648d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions