Docker Community Forums

Share and learn in the Docker community.

What is the correct step to interact with v2 api?


(Jungkkr) #1

I followed

and

testing to interact with v2 api, but I can’t get it working.

The steps I tried are:

  • Access to a particular endpoint by

curl -IL ${dockerhub}/v2/jungkkr/images/tags/list

This returns 401 unauthorized w/t a problem
HTTP/1.1 401 Unauthorized
Content-Type: application/json; charset=utf-8
Docker-Distribution-Api-Version: registry/2.0

  • Then try to obtain token with following command, which return nothing in fact.

curl -s -u : -d “service=registry.docker.io” -d “scope=repository:jungkkr/images:pull” -d “account=jungkkr” ${dockerhub}

  • Access the endpoint still returns unauthorized error.

curl ${dockerhub}/v2/jungkkr/images/tags/list

{“errors”:[{“code”:“UNAUTHORIZED”,“message”:“access to the requested resource is not authorized”,“detail”:[{“Type”:“repository”,“Name”:“jungkkr/images”,“Action”:“pull”}]}]}

How can I fix this problem?

Thanks.