Docker registry 2.0 API v2 Docker registry 2.0 API v2 curl curl

Docker registry 2.0 API v2


UPDATE (14 April 2016): Still not here in the distribution roadmap, but here is a particular issue about search.

UPDATE (12 November 2015): The API endpoints still do not yet exist and are not yet in the Docker Registry roadmap.

The problem here is that the new v2 Docker registry doesn't support that particular endpoint yet, as of this question and answer. You can check the source itself for the route endpoints, and you'll see that most of the API endpoints involve simple operations like uploading and tagging, but no implementation yet of the search endpoint. It's important here to note that the v2 registry is a completely different project than the v1 registry. It's even written in a completely different language (v1 was a Python project, whereas v2 uses Go, which is more in line with the rest of the Docker projects). It took me some time and serious reading to understand the dichotomy here between the registries. It is worth looking at this particular Github issue about the v2 registry for a deep-dive into a recent discussion on the state of the v2 registry, as well as some discussion about where they've been taking it.

So there's no search endpoint in the v2 registry yet. You can list your image by tag or by the image name itself as mentioned in task number 8 in this documentation.


if you're on windows, here's a Powershell script to query the v2/_catalog from windows with basic http auth.

https://gist.github.com/so0k/b59382ea7fd959cf7040

FYI, to use this you have to docker pull distribution/registry:master instead of docker pull registry:2. the registry:2 image version is currently 2.0.1 which does not come with the catalog endpoint.


I guess the easiest way to check if a docker image is present is by using the Docker V2 REST API Tags list service

Example:-

curl $CURLOPTS -H "Authorization: Bearer $token" "https://hub.docker.com:4443/v2/your-repo-name/tags/list"

if the above result returns 200Ok with a list of image tags, then we know that image exists

{"name":"your-repo-name","tags":["1.0.0.1533677221","1.0.0.1533740305","1.0.0.1535659921","1.0.0.1535665433","latest"]}

else if you see something like

{"errors":[{"code":"NAME_UNKNOWN","message":"repository name not known to registry","detail":{"name":"your-repo-name"}}]} 

then you know for sure that image doesn't exist.