alexfvolk
alexfvolk

Reputation: 1830

Docker 1.6 and Registy 2.0

Has anyone tried successfully the search command with Docker 1.6 and the new registry 2.0?

I've set mine up behind Nginx with SSL, and so far it is working fine. I can push and pull images without problems. But when I try to search for them all the following command give a 404 response:

curl -k -s -X GET https://username:[email protected]/v1/search
404 page not found

curl -k -s -X GET https://username:[email protected]/v2/search
404 page not found

root@ip-10-232-0-191:~# docker search username:[email protected]/hello-world
FATA[0000] Invalid repository name (admin:admin), only [a-z0-9-_.] are allowed

root@ip-10-232-0-191:~# docker search my-docker-registry.com/hello-world
FATA[0000] Error response from daemon: Unexpected status code 404

I wanted to ask if anyone has any ideas why and what is the correct way to use the Docker client to search the registry for images.

Looking at the API v2.0 documentation, do they simply not support a search function? Seems a bit strange to omit such functionality.

At least something works :)

root@ip-10-232-0-191:~# curl -k -s -X GET https://username:[email protected]/v2/hello-world/tags/list
{"name":"hello-world","tags":["latest"]}

Upvotes: 2

Views: 2163

Answers (3)

Vincent De Smet
Vincent De Smet

Reputation: 4979

To Date - the search api is lacking from registry v2.0.1 and this issue is under discussion here. I believe search api is intended to land in v2.1.

EDIT: /v2/catalog endpoint is available in distribution/registry:master

Before new registry api:

If you are using REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY you may list the contents of that directory

user@host:~#  tree $REGISTRY_FS_ROOTDIR/docker/registry/v2/repositories -L 2
***/docker/registry/v2/repositories
└── repository1
    └── image1

This may be useful to make a quick web ui you can call to do this or if you have ssh access to the host storing the repositories:

ssh -T user@host -p <port> tree $REGISTRY_FS_ROOTDIR/docker/registry/ -L 2

Do look at the compose example which deploys both v1 & v2 registry behind an nginx reverse proxy

Upvotes: 2

Vincent De Smet
Vincent De Smet

Reputation: 4979

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.

Upvotes: 1

ZephyrPLUSPLUS
ZephyrPLUSPLUS

Reputation: 2688

The latest version of Docker Registry available from https://github.com/docker/distribution supports Catalog API. (v2/_catalog). This allows for capability to search repositories.

If interested, you can try docker image registry CLI I built to make it easy for using the search features in the new Docker Registry v2 distribution : (https://github.com/vivekjuneja/docker_registry_cli)

Upvotes: 1

Related Questions