0

I am trying to get the image manifest of my private Docker image.

GET /v2/name/manifests/reference

It is returning the header: Www-Authenticate →Bearer realm="https://auth.docker.io/token",service="registry.docker.io",scope="repository:{username}:pull"

So I made a request: Www-Authenticate →Bearer realm="https://auth.docker.io/token",service="registry.docker.io",scope="repository:{username}:pull" and I got the token.

I added it to the header Authorization: Bearer {token}. But I still get 401 response.

Where do I put my username and password?

Valeri
  • 1,072
  • 5
  • 14
  • 31

1 Answers1

0

See Docker's documentation for an explanation of auth:

https://success.docker.com/article/how-do-i-authenticate-with-the-v2-api

Specifically:

USERNAME=[[YOUR-USERNAME]]
PASSWORD=[[YOUR-PASSWORD]]
TOKEN=$(\
  curl \
  --silent \
  --header "Content-Type: application/json" \
  --request POST \
  --data '{"username": "'${USERNAME}'", "password": "'${PASSWORD}'"}' \
  https://hub.docker.com/v2/users/login/ \
  | jq -r .token\
) & echo ${TOKEN}

This works for me for enumerating images and their tags.

I've been unable to query Docker's registry for manifests:

How to get manifests using HTTP API v2

DazWilkin
  • 32,823
  • 5
  • 47
  • 88