moby / moby/moby

When listing all images and filtering by reference (tag or digest), the other field isn't returned

Open
#48,612 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug status/0-triage
Dominant language
Go
Stars
72.1k
Forks
19.2k
Avg merge
1d 18h
Merged PRs (30d)
164

Description

Description

When listing all images, if the user filters them by reference (either by specifying an image:tag or image@digest), they response will either contain no digest (if filtering by tag) or no tags (if filtering by digest).

Reproduce

List all images (works properly):

$ docker image ls --digests
REPOSITORY                                   TAG             DIGEST                                                                    IMAGE ID       CREATED         SIZE
...
redis                                        6.2             sha256:7919fdd5300e7abf7ae95919e6f144b37c55df16553302dbbcc7495a5aa0c079   3ce579be26ab   4 months ago    106MB
...

Try filtering for an image with image:tag:

$ docker image ls -f reference=redis:6.2 --digests
REPOSITORY   TAG       DIGEST    IMAGE ID       CREATED        SIZE
redis        6.2       <none>    3ce579be26ab   4 months ago   106MB

Try filtering for an image with image@digest:

$ docker image ls -f reference=redis@sha256:7919fdd5300e7abf7ae95919e6f144b37c55df16553302dbbcc7495a5aa0c079 --digests
REPOSITORY   TAG       DIGEST                                                                    IMAGE ID       CREATED        SIZE
redis        <none>    sha256:7919fdd5300e7abf7ae95919e6f144b37c55df16553302dbbcc7495a5aa0c079   3ce579be26ab   4 months ago   106MB
Expected behavior

When filtering either by tag or digest, the output should contain both.

docker version

Client:
Version: 27.3.1
API version: 1.47
Go version: go1.23.1
Git commit: ce1223035a
Built: Wed Sep 25 14:43:43 2024
OS/Arch: linux/amd64
Context: default

Server:
Engine:
Version: 27.3.1
API version: 1.47 (minimum version 1.24)
Go version: go1.23.1
Git commit: 41ca978a0a
Built: Wed Sep 25 14:43:43 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.7.22
GitCommit: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c.m
runc:
Version: 1.1.14
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0

docker info

Client:
Version: 27.3.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: 0.17.1
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 2.29.7
Path: /usr/lib/docker/cli-plugins/docker-compose

Server:
Containers: 11
Running: 5
Paused: 0
Stopped: 6
Images: 35
Server Version: 27.3.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: true
Native Overlay Diff: false
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.11.1-arch1-1
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 20
Total Memory: 15.36GiB
Name:
ID: e16ef9e2-12d7-488c-81f8-330577332a0e
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

Additional Info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the docker image ls entry point and trace how reference filters populate image listing fields. Compare unfiltered, tag-filtered, and digest-filtered output using the reproductions in this issue. Done means both tag and digest are present in either filtered result, with coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.