Docker Community Forums

Share and learn in the Docker community.

Registry/HUB API is buggy


(Arul) #1

Hello,

I get {"error": "Requires authorization"} when I visit:

https://registry-1.docker.io/v1/repositories/clue/textract/tags

But

https://index.docker.io/v1/repositories/clue/textract/tags

Returns [{"layer": "5b4b0828", "name": "latest"}]


In case of official repos, for example:

https://index.docker.io/v1/repositories/_/postgres/tags

You get a 404.

But again {"error": "Requires authorization"} for:

https://registry-1.docker.io/v1/repositories/_/postgres/tags

So a bunch of questions:

  1. Why only 1 call succeeds? I think that all should succeed
  2. Why there is authorization without authentication?
  3. How to query the tags of a public repository?

Thanks.


(Ken Cochrane) #2

Arul,

you are talking with two different services, which have two different API’s. They look similar but are not.

registry-1.docker.io is the docker-registry used for storing images, this API is public, but requires authorization.

index.docker.io is the “index” now called RegistryHub, this tags endpoint is not public, and might change at any time. I would not use this one, since it is for internal use only, and may change without warning.

Answers to your questions.

  1. It fails because you need authorization when talking with the registry.
  2. You need an auth token, which comes from the index/ registryHub, if you auth against the registryHub it will give you a token which you can use against the docker-registry.
  3. You would need to do what you have, but with an valid token to the docker-registry.

We hope to offer an official API in the future that will make all of this much easier. I don’t have an ETA on when this might be available.


(B M) #3

I am trying to make this work - I understand what to do but the only trivial thing am stuck with is:

what are the “user credentials” one has to provide to the hub API to request the token?

In the doc as user credentials a string “QWxhZGRpbjpvcGVuIHNlc2FtZQ==” is shown - what string is this, where do I get it from?

Answer:
The credentials are in
~/.dockercfg

after having done a
sudo docker login


(B M) #4

Ok after getting the token I am stuck. I have tried every possible way of supplying the token to the registry but it just keeps replying with 401, auth required. Here is the header which I am supplying to the registry server https://registry-1.docker.io/v1/repositories/_/ubuntu/tags:

‘set-cookie’: ‘csrftoken=Nwz7S…; Expires=Fri, 26 Feb 2016 21:14:18 GMT; Max-Age=31449600; Path=/; Secure’
‘www-authenticate’: ‘Token signature=Nwz7S…,repository=“ubuntu”,access=read’
‘x-docker-token’: 'Token signature=Nwz7S…,repository=“ubuntu”,access=read’
Authenticate: ‘Token signature=Nwz7S…,repository=“ubuntu”,access=read’

As you can see I am supplying the token every possible way I could think of, including supplying it as cookie as returned by the Hub. No luck. I tried to packet-sniff how the docker cli does it but had no luck either.

How to proceed?

Thanks!


(B M) #5

I have had no luck resolving this issue - is the Docker registry API functioning at all?

If so, can anyone who is using it post a working code sample? Any framework / technology / language of your choice…