Given an image like this one

I want to be able to verify that the image I have matches


How can this be done in docker's command line tool?

2 Answers 2


Use this command

docker images --digests

You'll get this output

REPOSITORY    TAG       DIGEST                                                                    IMAGE ID       CREATED        SIZE
hello-world   latest    sha256:80f31da1ac7b312ba29d65080fddf797dd76acfb870e677f390d5acba9741b17   feb5d9fea6a5   8 months ago   13.3kB

For a given image, these are listed in the RepoDigests section of the inspect:

$ docker image inspect nginx --format '{{json .RepoDigests}}'

Note that there are multiple digests for an image. One for a manifest list when you have multi-platform images (this contains the digests for platform specific images). Another for a platform specific image, which is what Hocker Hub shows on their website. And that image manifest contains digests for the image config and layers. The image config is the json describing things like the entrypoint, user, and other settings associated with the image, and this is used as the image ID in Docker.

That image ID is going to be unique to an image since it also contains a version of the layer digests (those digests will be different since they're uncompressed and other digests for layers will be on the compressed version). So if you don't have a repo digest, you can compare the image ID to the config digest to see if they match. E.g.

$ regctl manifest get localhost:5000/library/alpine --platform linux/arm64
Name:        localhost:5000/library/alpine
MediaType:   application/vnd.docker.distribution.manifest.v2+json
Digest:      sha256:c3c58223e2af75154c4a7852d6924b4cc51a00c821553bbd9b3319481131b2e0
Total Size:  2.694MB
  Digest:    sha256:6e30ab57aeeef1ebca8ac5a6ea05b5dd39d54990be94e7be18bb969a02d10a3f
  MediaType: application/vnd.docker.container.image.v1+json
  Size:      1487B
  Digest:    sha256:b3c136eddcbf2003d3180787cef00f39d46b9fd9e4623178282ad6a8d63ad3b0
  MediaType: application/vnd.docker.image.rootfs.diff.tar.gzip
  Size:      2.694MB

$ docker image inspect alpine --format '{{.ID}}'

That config digest is only useful for comparison, you still need the manifest digest if you want to pull the image from the registry.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.