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 7 years ago
  • Reactions: 17
  • Comments: 19 (3 by maintainers)

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

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.