docker image id vs digests



returns an imageId

docker build 
Successfully built d4a6

the .Id changes only if a new image is built. If nothing was really built the id doesn't change.


get an image Id and a digest.

The digest is only generated when the image is pushed to a registry

docker images --digests --format '{{ json . }}'

docker image inspect
# Id: [0].Id
# digest: [0].RepoTags[0]

docker image inspect --format '{{ .Id }}'

pushing the image

will echo the digest

docker push

try inspecting to see the digest.

check from the registry

curl -v -H 'Accept: application/vnd.docker.distribution.manifest.v2+json'

on obtient le imageId en header :

docker-content-digest: sha256:3b9a13

le digest est dans le json : config.digest