Docker Community Forums

Share and learn in the Docker community.

Inconsitent behavior of API : https://registry.hub.docker.com/v1/repositories/nginx/tags/[tag]

dockerhub

(Sidoak) #1

We use the following API to find if the repo and tag is available on the hub for download. Only if it returns a response suggesting so, we go for a docker pull.

Error condition:
Command -
curl -i -X GET https://registry.hub.docker.com/v1/repositories/nginx/tags/latest

Response
HTTP/1.1 404 NOT FOUND
Server: nginx/1.6.2
Date: Fri, 10 Jun 2016 05:13:29 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=31536000

Tag not found

==================================================

But when we execute the following command, it works
Command -
curl -i -X GET https://registry.hub.docker.com/v1/repositories/nginx/tags/1.9

Response:
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Fri, 10 Jun 2016 05:14:47 GMT
Content-Type: application/json
Transfer-Encoding: chunked
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=31536000

[{“pk”: 21662675, “id”: “0e181a34”}, {“pk”: 21662676, “id”: “aa527287”}, {“pk”: 21662677, “id”: “cc90a59a”}, {“pk”: 21662678, “id”: “251bbadf”}, {“pk”: 21662679, “id”: “6f88661d”}, {“pk”: 21665286, “id”: “1f3613e1”}, {“pk”: 21665285, “id”: “c7fb0a07”}, {“pk”: 21665284, “id”: “ab998deb”}]

Since I can see the tag - “latest” to be available for nginix when I check on the hub, what could be the reason for the curl command to send back a response saying “Tag not found” ?

Any suggestions?


(Taoli) #2

Having the same issue with my private repo. seems to just started happening recently.


(Eli Young) #3

It looks like this is the v1 API only returning images created with a V1 Docker manifest. Using https://registry.hub.docker.com/v2/repositories/library/nginx/tags/latest works fine, though. Note that, since, nginx is an official image, it becomes library/nginx in the URL. A regular image (e.g. openshift/origin-haproxy-router) would not have library/ in the URL (e.g. https://registry.hub.docker.com/v2/repositories/openshift/origin-haproxy-router/tags/v1.3.0/).

tl;dr Use https://registry.hub.docker.com/v2/repositories/$REPO/tags/$TAG. Official images have $REPO of library/$IMAGE.