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

Created on 4 Dec 2017  路  15Comments  路  Source: docker/cli

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

aredistribution kinbug

Most helpful comment

This is another way to do it

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

All 15 comments

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?

Was this page helpful?
0 / 5 - 0 ratings