I´d like to pull the images of centos, tomcat, ... using their sha256 code, like in
docker pull myimage@sha256:0ecb2ad60
but I can´t find the sha256-code to use anywhere.
I checked the dockerhub repository for any hint of the sha256-code, but couldn't find any. I downloaded the images by their tag
docker pull tomcat:7-jre8
and checked the image with docker inspect
to see if theres a sha256 code in the metadata, but there is none (adding the sha256 code of the image would probably change the sha256 code).
Do I have to compute the sha256 code of an image myself and use that?
Just issue
docker pull tomcat:7-jre8
again and you will get what you want.This should have been the Id field, that you could see in the old deprecated Docker Hub API
BUT: this is not how it is working now with the new docker distribution.
See issue 628: "Get image ID with tag name"
The current (mid 2015) answer is:
In addition to the existing answers, you can use the
--digests
option while doingdocker images
to get a list of digests for all the images you have.You can add a grep to drill down further
Latest answer
Edit suggested by OhJeez in the comments.
Original answer
I believe you can also get this using
Works only in Docker 1.9 and if the image was originally pulled by the digest. Details are on the docker issue tracker.
Just saw it:
When I pull an image, the sha256 code is diplayed at the bottom of the output (Digest: sha....):
This sha code
can be used to pull the image afterwards with
This way you can be sure that the image is not changed and can be safely used for production.
You can get it by
docker images --digests