How to get manifest from docker registry using REST api?

I am trying to retrieve manifest using REST api from docker registry.

Based on what I found in

I was able to retrieve the token using:

TOKEN=$(curl -v -X GET "" -H "Authorization: ApiKey <base_64_ngc_api_key>" -H "Accept: application/json" | jq -r '.token')

But I am still not able to retrieve manifest using:

curl -X GET -vvv -k -H "Authorization: Bearer ${TOKEN}" -H "Accept: application/json" -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -H "Accept: application/vnd.docker.distribution.manifest.v1+prettyjws" -H "Accept: application/vnd.docker.distribution.manifest.v1+json"

Any clue on how to resolve that?

Find out the authentication realm and scope:

$ curl -si | grep Authenticate
Www-Authenticate: Bearer realm="",scope="repository:nvidia/cuda:pull,push"

Next get a bearer token to pull:

TOKEN=$(curl -s -X GET "" -H "Authorization: ApiKey <your api key>" | sed 's/{"token":"//;s/".*//')

Then use the token for your query:

curl -s -H "Authorization: Bearer ${TOKEN}"

Hope that helps!