docker image id vs digests

Retour

building

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.

inspecting

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 . }}' registry.raphaelpiccolo.com/flatbay

docker image inspect registry.raphaelpiccolo.com/flatbay
# Id: [0].Id
# digest: [0].RepoTags[0]

docker image inspect --format '{{ .Id }}' registry.raphaelpiccolo.com/flatbay

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' https://registry.raphaelpiccolo.com/v2/flatbay/manifests/latest

on obtient le imageId en header :

docker-content-digest: sha256:3b9a13

le digest est dans le json : config.digest