7

I'm using Docker 1.10.3.

Docker Image Specification v1.0.0 says there is an Image Checksum field in a Docker Image JSON Description, like:

"checksum": "tarsum.v1+sha256:e58fcf7418d2390dec8e8fb69d88c06ec07039d651fedc3aa72af9972e7d046b",

However, there is no such a field in the result of docker inspect <IMAGE>.

How can I get the checksum of a particular image?

Akihiro HARAI
  • 584
  • 1
  • 7
  • 15
  • 4
    Maybe relevant https://stackoverflow.com/questions/32046334/what%C2%B4s-the-sha256-code-of-a-docker-image – jDo Mar 13 '16 at 07:32
  • 1
    as @jDo mentioned, see: https://stackoverflow.com/a/33511811 which answers this: `docker inspect --format='{{index .RepoDigests 0}}' $IMAGE` where $IMAGE can contain the tag. – ldg Dec 14 '17 at 06:35

2 Answers2

11

You have the command

$ docker images --digests

for example:

docker images --digests busybox
REPOSITORY          TAG                 DIGEST                                                                    IMAGE ID            CREATED             SIZE
busybox             latest              sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f   00f017a8c2a6        2 months ago        1.11 MB
rjmunro
  • 26,015
  • 18
  • 106
  • 132
user2915097
  • 27,609
  • 6
  • 52
  • 56
4
docker images --digests --format '{{.Digest}}' IMAGE

Recent Docker versions introduced this new command that may deprecate the above:

docker image ls --digests --format '{{.Digest}}' IMAGE
Ricardo Branco
  • 5,328
  • 1
  • 19
  • 29