moby: Digest not shown when image tag specified

Digests are shown for pushed images with docker images --digests ...

$ docker push example.com/foo/bar:master
The push refers to a repository [example.com/foo/bar]
9ce98538809e: Layer already exists 
91a8f3990fa4: Layer already exists 
837094365fb4: Layer already exists 
9708155555f8: Layer already exists 
b91611bea4a8: Layer already exists 
148b5a1af9ed: Layer already exists 
011b303988d2: Layer already exists 
master: digest: sha256:164b5fc83e34c2c1d59a430c7b64ecd010902f13c62ba9dcc50efb771c4060b2 size: 12564
                                                                                                                                                              
$ docker images --digests example.com/foo/bar
REPOSITORY                         TAG                 DIGEST                                                                    IMAGE ID            CREATED             SIZE
example.com/foo/bar   master              sha256:164b5fc83e34c2c1d59a430c7b64ecd010902f13c62ba9dcc50efb771c4060b2   d594640ae3af        2 hours ago         63.02 MB
example.com/foo/bar   <none>              sha256:6fd65f7141dc61adeb9f262784b1aca9848866d2d4b68c3a10ecf0aa2d1edef6   1c270a40466d        3 days ago          63.02 MB
example.com/foo/bar   <none>              sha256:0b9e94db5aaedb6f6407778d803e99b0e7dd2e710842611873411717dd51e7b8   c42d40e9c60b        3 days ago          63.02 MB
example.com/foo/bar   <none>              sha256:a5aee68356dba08f0576396d8cbd23cf48630391e00d3197c2b237cbedc8a7a2   998b383b2bcb        2 weeks ago         63.02 MB
example.com/foo/bar   <none>              sha256:076ff9b7dc7cadf2a74d7bf5b7226c0b69ef18e9d29834c2c2e0f3efca019aba   a6df32f2ad19        2 weeks ago         62.08 MB
example.com/foo/bar   <none>              sha256:a8a4411a3f6f89c9215a24adfa5ae3c62d04052c53039fd594002a78118ecf1d   7bc456afeef5        2 weeks ago         62.08 MB
example.com/foo/bar   <none>              sha256:eb448ad5b5d1a6b8d425e90c37056c82c90809ffbf3e6486f601351893fe2785   973e019e1f45        4 weeks ago         429.8 MB

But not when you specify an image tag (a bug).

$ docker images --digests example.com/foo/bar:master
REPOSITORY                         TAG                 DIGEST              IMAGE ID            CREATED             SIZE
example.com/foo/bar   master              <none>              d594640ae3af        2 hours ago         63.02 MB
$ docker version
Client:
 Version:      1.12.2-rc1
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   45bed2c
 Built:        Tue Sep 27 23:38:15 2016
 OS/Arch:      darwin/amd64
 Experimental: true

Server:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Wed Oct 26 22:01:48 2016
 OS/Arch:      linux/amd64

$ docker info
Containers: 28
 Running: 9
 Paused: 0
 Stopped: 19
Images: 328
Server Version: 1.12.3
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 381
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: host null bridge overlay
Swarm: active
 NodeID: en2leu93wlp34nkla3yxmyfos
 Is Manager: true
 ClusterID: eujs1t26dcn9io4jfb61y37gh
 Managers: 1
 Nodes: 1
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Heartbeat Tick: 1
  Election Tick: 3
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
 Node Address: 172.31.1.100
Runtimes: runc
Default Runtime: runc
Security Options: apparmor seccomp
Kernel Version: 4.4.0-38-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.859 GiB
Name: hubnet-1
ID: CG3A:5KVP:ITEW:CF74:GDPB:GLXU:PK5D:5Z6P:PXWD:AKAS:GKWK:D6LV
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: j0hnsmith
Registry: https://index.docker.io/v1/
Labels:
 provider=generic
Insecure Registries:
 127.0.0.0/8

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 3
  • Comments: 20 (7 by maintainers)

Most upvoted comments

@RRAlex been bitten by this all day today until I found your comment.

Oh, understood, I thought it was the hash of the image, not only registry pulled ones.

That said, for the first question, shouldn’t the --format referring to a digest still be showing the hash, even without the --digests?

Simply, --digests should only have an impact when the user isn’t adding the --format argument as they overlap in functionality. My 2¢ but… otherwise, I find that showing <none>, even though the image does have a digest, could be misleading to the user? cheers!

@RRAlex the digest that’s shown is the RegistryDigest, and only available for images that are pulled from a registry. Other images don’t have a digest, and are shown as <none>.

API-wise this behavior doesn’t make any sense. /images returns list of image objects, every object has array of repotags and digests. We should always return full arrays here. Filter should be for filtering out objects, not to change any properties of individual objects. Because our CLI doesn’t match the API we probably have to do a extra pass on the cli side.