We want to check if the image exists in the shared registry (Docker Hub) before we begin the deployment. With API v1, we simply request https://index.docker.io/v1/repositories/gliderlabs/alpine/tags/3.2 , for example.
But now the official registry API is v2, what is the official way to check for an image in the public registry?
v1
$ curl -i https://index.docker.io/v1/repositories/gliderlabs/alpine/tags/latest HTTP/1.1 200 OK Server: nginx/1.6.2 Date: Tue, 11 Aug 2015 10:02:09 GMT Content-Type: application/json Transfer-Encoding: chunked Vary: Cookie X-Frame-Options: SAMEORIGIN Strict-Transport-Security: max-age=31536000 [{"pk": 20307475, "id": "5bd56d81"}, {"pk": 20355979, "id": "511136ea"}]
v2
$ curl -i https://index.docker.io/v2/repositories/gliderlabs/alpine/tags/latest HTTP/1.1 301 MOVED PERMANENTLY Server: nginx/1.6.2 Date: Tue, 11 Aug 2015 10:04:20 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked X-Frame-Options: SAMEORIGIN Location: https://index.docker.io/v2/repositories/gliderlabs/alpine/tags/latest/ Strict-Transport-Security: max-age=31536000 $ curl -i https://index.docker.io/v2/repositories/gliderlabs/alpine/tags/latest/ HTTP/1.1 301 MOVED PERMANENTLY Server: nginx/1.6.2 Date: Tue, 11 Aug 2015 10:04:26 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked X-Frame-Options: SAMEORIGIN Location: https://registry.hub.docker.com/v2/repositories/gliderlabs/alpine/tags/latest/ Strict-Transport-Security: max-age=31536000 $ curl -i https://registry.hub.docker.com/v2/repositories/gliderlabs/alpine/tags/latest/ HTTP/1.1 200 OK Server: nginx/1.6.2 Date: Tue, 11 Aug 2015 10:04:34 GMT Content-Type: application/json Transfer-Encoding: chunked Vary: Cookie X-Frame-Options: SAMEORIGIN Allow: GET, DELETE, HEAD, OPTIONS Strict-Transport-Security: max-age=31536000 {"name": "latest", "full_size": 5250074, "id": 130839, "repository": 127805, "creator": 152141, "last_updater": 152141, "image_id": null, "v2": false}
Should I stick to URL v1 , although now it is deprecated or uses URL v2 , but there is no documentation about this? If I use v2 , should I use https://registry.hub.docker.com/v2/ directly or use https://index.docker.io/v1/ and follow the redirects?
docker docker-registry dockerhub
jtblin
source share