Authorization error when Registry api

Hi

I am trying to programmatically (REST api) determine the digest of an mysql image on docker’s public registry.

Here are some of the versions available

  • [ 8.0.19 , 8.0 , 8 , latest ]
  • [ 5.7.29 , 5.7 , 5 ]
  • [ 5.6.47 , 5.6 ]

I use curl command to run the REST api as follows

curl -H “Accept: application/vnd.docker.distribution.manifest.v2+json” -k -v -X GET https://registry.hub.docker.com/v2/repositories/mysql/manifests/latest

on execution I get the authorization error

{“errors”:[{“code”:“UNAUTHORIZED”,“message”:“authentication required”,“detail”:[{“Type”:“repository”,“Class”:“”,“Name”:“repositories/mysql”,“Action”:“pull”}]}]}

Here are some of the steps I took too solve the issue but all in-vain.

  1. Using CLI I logged in to the docker registry and then ran the above curl command

  2. Created a token and added to the postman as follows
    curl https://auth.docker.io/token?service=registry.docker.io&scope=repository:mysql:pull,push

       added the token as header - Authorization : bearer <token>
    

Can some one please provide some input on how i can resolve this

thanks