'How to get the digest of image with specific tag by using Docker repository API from Docker Hub

I am going to get the digest of image with specific tag on Docker Hub. There are 3 images with different tags on docker Hub. Could you provide the curl & GET command example for getting the image digest with specific tag on Docker Hub? Thank you.



Solution 1:[1]

This should work fine: Can I get an image digest without downloading the image?

docker inspect --format='{{index .RepoDigests 0}}' dockerHubRepo/dockerImageName:tag

Or (cf the above link) :

curl -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \
     -H "Authorization: Basic ${username_password_base64}" \
     'https://auth.docker.io/token?service=registry.docker.io&scope=repository:dockerHubRepo/dockerImageName:tag:pull'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bguess