docker-registry-web icon indicating copy to clipboard operation
docker-registry-web copied to clipboard

curl UNAUTHORIZED

Open christopherwoo opened this issue 6 years ago • 5 comments

curl UNAUTHORIZED

I run docker-compose.yml in docker-registry-web/examples/auth-enabled, and everything work fine. Now I have thoudsands of images to prune, and I choose not to delete them one by one using Web UI. I want to try a script contains curl command, but when runing

curl ipaddress:5000/v2/_catalog

I got

{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"registry","Name":"catalog","Action":"*"}]}]}

How to get auth and run curl ?

christopherwoo avatar Jan 19 '19 07:01 christopherwoo

My configuration

cat conf/registry/config.yml
version: 0.1

storage:
  filesystem:
    rootdirectory: /registry
  delete:
    enabled: true
    
http:
  addr: 0.0.0.0:5000    

auth:
  token:
    #realm: http://localhost:8080/api/auth
    #service: localhost:5000
    realm: http://ipaddress:8080/api/auth
    service: ipaddress:5000
    issuer: test
    rootcertbundle: /etc/docker/registry/auth.cert

log:
  level: info
  
notifications:
  endpoints:
    - name: listener
      url: http://registry-web:8080/api/notification
      timeout: 500ms
      threshold: 5
      backoff: 1s

ipaddress is a lan ip address.

christopherwoo avatar Jan 19 '19 07:01 christopherwoo

I see now how to get token (GET http://ipaddress:8080/api/auth), but still confuse how to use token in curl.

christopherwoo avatar Jan 24 '19 03:01 christopherwoo

I am facing the same issue. how can I do it?

Cronist avatar Apr 04 '23 11:04 Cronist

I am facing the same issue. how can I do it?

https://www.arthurkoziel.com/dockerhub-registry-api/ ?

s3bul avatar Apr 04 '23 17:04 s3bul

I am facing the same issue. how can I do it?

https://www.arthurkoziel.com/dockerhub-registry-api/ ?

thank you so much for your reply.

but the link is not working with the docker-registry-web auth. I mean even if you will send like that

curl -s -H "Content-Type: application/json" -X POST -d '{"j_username": "exiting_username", "j_password": "real_password"}' https:///api/auth](http://ipaddress:8080/api/auth

OR

curl -s -H "Content-Type: application/json" -X POST -d '{"username": "exiting_username", "password": "real_password"}' https:///api/auth](http://ipaddress:8080/api/auth

the answer is

No auth

So I am still looking for a solution to obtain a TOKEN from docker-regitry-web via wget or curl.

Cronist avatar Apr 04 '23 20:04 Cronist