cli: docker images --digest image does not display digest

Description

The image digest is <none> if you specify the image.

Steps to reproduce the issue:

C:\Users\camer\tmp> docker images --digests
REPOSITORY          TAG                 DIGEST                                                                    IMAGE ID            CREATED             SIZE
mono                latest              sha256:55ce025f24578afe68cdf579dd3a42b9af7e4c729eadefa1f0a236d6387a8eb2   61351f52f2f9        3 weeks ago         531MB
mono                slim                sha256:9cb9c6131656a1ea0413e22fa5854a38672d792e63be3fd51c4da214b43113ae   ac8dc438b799        3 weeks ago         170MB
C:\Users\camer\tmp> docker images --digests mono:slim
REPOSITORY          TAG                 DIGEST              IMAGE ID            CREATED             SIZE
mono                slim                <none>              ac8dc438b799        3 weeks ago         170MB

Describe the results you received:

Describe the results you expected: I want the digest displayed.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

C:\Users\camer\tmp> docker --version
Docker version 17.09.0-ce, build afdb6d4

Output of docker info:

C:\Users\camer\tmp> docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 2
Server Version: 17.09.0-ce
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: moby
ID: XEH3:K2GT:SI6C:LDQH:CCLI:46Y2:IISU:RXUS:56QI:GLQJ:25TP:DCXF
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 16
 Goroutines: 26
 System Time: 2017-12-04T22:02:36.4444744Z
 EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

Additional environment details (AWS, VirtualBox, physical, etc.):

Looks related to https://github.com/docker/cli/pull/439

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Reactions: 19
  • Comments: 21 (3 by maintainers)

Commits related to this issue

Most upvoted comments

This is another way to do it

$ docker image inspect <image_name_or_id> -f '{{.RepoDigests}}'

It looks like no one wants to fix the “show digest” command to actually show digests!

Ah the image has to be pushed before digest is calculated - see https://github.com/moby/moby/issues/32016

Maybe this helps identifying the problem, when a tag is given, the digest is always <none> for me:

$ docker image ls --digests postgres:13
REPOSITORY   TAG       DIGEST    IMAGE ID       CREATED       SIZE
postgres     13        <none>    84864a0c80e5   5 weeks ago   413MB

$ docker image ls --digests postgres:14
REPOSITORY   TAG       DIGEST    IMAGE ID       CREATED         SIZE
postgres     14        <none>    f4e4b6041bd6   11 months ago   376MB

docker image ls --digests postgres:15
REPOSITORY   TAG       DIGEST    IMAGE ID       CREATED        SIZE
postgres     15        <none>    81c91c6cdecf   3 months ago   411MB

$ docker image ls --digests postgres:16
REPOSITORY   TAG       DIGEST    IMAGE ID       CREATED        SIZE
postgres     16        <none>    f7d9a0d4223b   3 months ago   417MB

vs

$ docker image ls --digests postgres   
REPOSITORY   TAG       DIGEST                                                                    IMAGE ID       CREATED         SIZE
postgres     13        sha256:9167bfa128429fb9c36df04b6d4c2f2d1751f3db105e00d60b514248f959c5bb   84864a0c80e5   5 weeks ago     413MB
postgres     16        sha256:3d9ed832906091d609cfd6f283e79492ace01ba15866b21d8a262e8fd1cdfb55   f7d9a0d4223b   3 months ago    417MB
postgres     15        sha256:3faff326de0fa3713424d44f3b85993459ac1917e0a4bfd35bab9e0a58e41900   81c91c6cdecf   3 months ago    411MB
postgres     14        sha256:c2a30d08a6f9e6c365595fd086c9e0436064c52425f15f72379ecf0807bac518   f4e4b6041bd6   11 months ago   376MB
$ docker version
Client:
 Version:           24.0.7
 API version:       1.43
 Go version:        go1.21.3
 Git commit:        afdd53b4e3
 Built:             Sun Oct 29 15:42:02 2023
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.21.3
  Git commit:       311b9ff0aa
  Built:            Sun Oct 29 15:42:02 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.7.11
  GitCommit:        64b8a811b07ba6288238eefc14d898ee0b5b99ba.m
 runc:
  Version:          1.1.10
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

I can still reproduce (MacOS 13.2.1, docker 20.10.17) :

$ docker images --digests alpine
REPOSITORY   TAG       DIGEST                                                                    IMAGE ID       CREATED         SIZE
alpine       latest    sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4   49176f190c7e   3 months ago    7.05MB
alpine       <none>    sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300   c059bfaa849c   15 months ago   5.59MB
$ docker images --digests alpine:latest
REPOSITORY   TAG       DIGEST    IMAGE ID       CREATED        SIZE
alpine       latest    <none>    49176f190c7e   3 months ago   7.05MB
$ docker --version
Docker version 20.10.17, build 100c701

I encountered the same issue. RepoDigests returned from the daemon was empty. Is there any workaround?

FYI @shhsu

EDIT

I found the daemon wouldn’t return digest for local build images until I pushed the images.