I am trying to figure out how to determine the digest of an image on my local machine.
If I ask docker images
to tell me about the digests for my image, it will happily tell me the correct answer:
rcv@mymachine:~$ docker images -a --digests docker.myregistry.net/myproject/myimage
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
docker.myregistry.net/myproject/myimage 8.0.0-rc9 sha256:56993a4bdf42a6337c1e9a32603c8758d9a67b42b525c18c6d500b8688f50c47 2198f19aede7 3 days ago 1.84GB
However, if I try asking specifically about the tag I'm interested in it will tell me that there's no digest.
rcv@mymachine:~$ docker images -a --digests docker.myregistry.net/myproject/myimage:8.0.0-rc9
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
docker.myregistry.net/myproject/myimage 8.0.0-rc9 <none> 2198f19aede7 3 days ago 1.84GB
I've been alternating between building this image locally, and just pulling it back down from the registry. Is it possible that docker images
is confused, or am I missing some subtle difference between the above two commands?
Thanks!
CodePudding user response:
That appears to be a bug in the docker CLI. This shouldn't have any impact on the underlying digest. If you know the image you want to query, it's probably easier to inspect that image for the digest:
$ docker image inspect nginx:latest --format '{{index .RepoDigests 0}}'
nginx@sha256:644a70516a26004c97d0d85c7fe1d0c3a67ea8ab7ddf4aff193d9f301670cf36