cli
cli copied to clipboard
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
yep, I can reproduce it. It looks like if the tag is added to timage name, then the digests is not displayed.
I will investigate this a little bit more.
Thanks a lot @ctaggart
EDIT
It looks like this is not really related to #439.
digests isn't shown because the response from the backed doesn't include digests.
I am trying to figure out why this happens.
EDIT 2
When passing reference with tag, the daemon detects that this is a named-tag reference and doesn't append its digests to RepoDigests.
It doesn't relate to the client side at all.
@thaJeztah I remember someone complained about missing digests when using Moby API. Do I remember correctly?
Thanks.
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.
I see this also when using --filter by image and tag. If I filter just by the image name but not the tag the digest is displayed correctly.
Same here:
$ docker images --digests | grep alpine | grep 3.6
alpine 3.6 sha256:f006ecbb824d87947d0b51ab8488634bf69fe4094959d935c0c103f4820a417d 76da55c8019d 12 months ago 3.97 MB
vs
$ docker images --digests alpine:3.6
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
alpine 3.6 <none> 76da55c8019d 12 months ago 3.97 MB
This is another way to do it
$ docker image inspect <image_name_or_id> -f '{{.RepoDigests}}'
@vikas027 It doesn't work either, right?
@vikas027 That works for me - thanks!
Hmm it actually doesn't work consistently.
Ah the image has to be pushed before digest is calculated - see https://github.com/moby/moby/issues/32016
Yeah, because digest is dependent on the registry provider.
Has there been any progress here? @vikas027 are you saying that pushing to different registries will result in different digests?
yes @jharveysmith . sha256 (or Id) changes when you have different registries. If you want to check the integrity of the image, use RepoDigests
It looks like no one wants to fix the "show digest" command to actually show digests!
It looks like no one wants to fix the "show digest" command to actually show digests!
Does this help you?
@vikas027 this is old but for your reference, no, all that alternate way of displaying an image with a missing digest does is show []
In the case I just ran into, minikube (a separate project) pulled some images as part of installing a "minikube add-on" and it seemed to pull the docker image down without a manifest. Pulling the same image with other tags with docker client got manifests on those other tags, but not the ones that were pulled for me. Re-pulling the same image and tag with docker client got the manifest though. Doubt this is related to OP or @spellers issue, but incase it helps anyone else consider how your images got pulled - if it was directly through CRI-O or something then that might be the cause of your issue.
5 years-old bug and still no fix
I stumbled upon this issue because I had another one related to digests of images.
But I can't reproduce this problem. Here is the output of the command I have with alpine:
My Docker version:

So this issue can probably be closed :)
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
Maybe this helps identifying the problem, when a tag is given, the digest is always
$ 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