If I understand how the docker pull works it’s supposed to check the SHA256SUM to see if there’s a discrepancy between what’s the official published image and what’s downloaded.
So before doing the download I went to
(1) https://hub.docker.com/_/ubuntu?tab=tags&page=1&name=focal
and to
(2) https://partner-images.canonical.com/core/focal/current/SHA256SUMS
to get the SHA256 tags for ubuntu:focal
According to (1) the SHA256 on amd64 for ubuntu:focal is
Digest:sha256:60f560e52264ed1cb7829a0d59b1ee7740d7580e0eb293aca2d722136edb1e24
According to (2) the SHA256SUM is
4f3f0de8799c8cbda1990d78182aaca0f5eb9b66315704b229374f2c62099ef7 *ubuntu-focal-core-cloudimg-amd64-root.tar.gz
and when I do “docker pull” I get a completely different SHA256SUM from both.
$ sudo docker pull ubuntu:focal
focal: Pulling from library/ubuntu
3ff22d22a855: Pull complete
e7cb79d19722: Pull complete
323d0d660b6a: Pull complete
b7f616834fd0: Pull complete
Digest: sha256:5d1d5407f353843ecf8b16524bc5565aa332e9e6a1297c73a92d3e754b8a636d
Status: Downloaded newer image for ubuntu:focal
docker.io/library/ubuntu:focal
$ export DOCKER_CONTENT_TRUST=1 && sudo docker pull ubuntu:focal
focal: Pulling from library/ubuntu
Digest: sha256:5d1d5407f353843ecf8b16524bc5565aa332e9e6a1297c73a92d3e754b8a636d
Status: Image is up to date for ubuntu:focal
docker.io/library/ubuntu:focal
$ sudo docker images --digests
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
ubuntu focal sha256:5d1d5407f353843ecf8b16524bc5565aa332e9e6a1297c73a92d3e754b8a636d 1e4467b07108 33 hours ago 73.9MB
I did a search across all the recent images at (1) and NONE of them match the digest reported by docker pull.
So where is this SHA256 for ubuntu:focal coming from in docker pull and why does it not match any SHA256 I can find on (1) or (2)?