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

1.9k views Asked by At

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.

1

There are 1 answers

0
Bguess On

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'