When one does continuous pushes (with updated content) to the same Docker Image Tag in a Docker Registry, the image in the registry will end up with multiple digests:
docker build -t test_repo:my_tag .
docker image tag test_repo:my_tag docker-registry.local.domain:5000/test_repo:my_tag
docker push docker-registry.local.domain:5000/test_repo:my_tag
→ digest: sha256:4f8f2ec8773c8cfe3d3432db5add85bd17c7e2a6a0e0f987d0783d31ddf3eabf
vim Dockerfile
→ Edit the Dockerfile in some way
docker build -t test_repo:my_tag .
docker image tag test_repo:my_tag docker-registry.local.domain:5000/test_repo:my_tag
docker push docker-registry.local.domain:5000/test_repo:my_tag
→ digest: sha256:d53a78d96bfb136b5f99a945f8a1671a1c365d8a2455bd4ba0c4f7a82409f007
A client is able to pull these different versions of the same image tag by using the digest value.
Is there a way to find these two digests of the same image tag (test_repo:my_tag) in the Docker Registry ?
I read through the documentation of the Docker Registry API and did some tests, but there doesn’t seem to be a documented solution.
It seems that only the latest digest (sha256:d53a78d96bfb136b5f99a945f8a1671a1c365d8a2455bd4ba0c4f7a82409f007) of this image tag (test_repo:my_tag) can be found from a registry:
curl -H “Accept: application/vnd.docker.distribution.manifest.v2+json” -X GET -vvv -k docker-registry.local.domain:5000/v2/test_repo/manifests/my_tag
→ Docker-Content-Digest: sha256:d53a78d96bfb136b5f99a945f8a1671a1c365d8a2455bd4ba0c4f7a82409f007
Docker Hub seems to have the same issue. When you open a public repository on Docker Hub you are only able to find the latest digest of a specific Image Tag.
Any other API endpoint I can try or some other solution ?
Docker Host OS: CentOS 7.6.1810
Docker Daemon Version: 19.03.5
Docker Registry Version: 2.X (The latest one from 2020)