How to search images from private 1.0 registry in docker?

DockerDocker Registry

Docker Problem Overview


I made a private registry,curl xx.xx.xx.xx:5000 is ok. I push an image into docker private registry by doing: docker push xx.xx.xx.xx:5000/centos
it return:
http://xx.xx.xx.xx:5000/v1/repositories/centos/tags/latest

the question is how to get all images from registry web or command whatever. I cant find any information from docker registry api. any one helps ? :)

Docker Solutions


Solution 1 - Docker

Now from docker client you can simply search your private registry directly without using the HTTP APIs or any extra tools:

e.g. searching for centos image:

docker search localhost:5000/centos

Solution 2 - Docker

So I know this is a rapidly changing field but (as of 2015-09-08) I found the following in the Docker Registry HTTP API V2:

GET /v2/_catalog
GET /v2/<name>/tags/list

Based on that the following worked for me on a local registry (registry:2 IMAGE ID 1e847b14150e365a95d76a9cc6b71cd67ca89905e3a0400fa44381ecf00890e1 created on 2015-08-25T07:55:17.072):

$ curl -X GET http://localhost:5000/v2/_catalog
{"repositories":["ubuntu"]}
$ curl -X GET http://localhost:5000/v2/ubuntu/tags/list
{"name":"ubuntu","tags":["latest"]}

Solution 3 - Docker

As of v 0.7.0 of the private registry you can do:

$ curl -X GET http://localhost:5000/v1/search?q=postgresql

and you will get a json payload:

{"num_results": 1, "query": "postgresql", "results": [{"description": "", "name": "library/postgresql"}]}

to give more background here is how I started my registry:

docker run \
        -e SETTINGS_FLAVOR=local \
        -e STORAGE_PATH=/registry \
        -e SEARCH_BACKEND=sqlalchemy \
        -e LOGLEVEL=DEBUG \
        -p 5000:5000 \
        registry

Solution 4 - Docker

Currently there's no search support for Docker Registry v2.

There was a long-running thread on the topic. The current plan is to support search with an extension in the end, which should be ready by v2.1.

As a workaround, execute the following on the machine where your registry v2 is running:

> docker exec -it <your_registry_container_id> bash
> ls /var/lib/registry/docker/registry/v2/repositories/

The images are in subdirectories corresponding to their namespace, e.g. jwilder/nginx-proxy

Solution 5 - Docker

Was able to get everything in my private registry back by searching just for 'library':

docker search [my.registry.host]:[port]/library

Returns (e.g.):

NAME                    DESCRIPTION   STARS     OFFICIAL   AUTOMATED
library/custom-image                  0                    
library/another-image                 0                    
library/hello-world                   0

Solution 6 - Docker

List all images

docker search <registry_host>:<registry_port>/

List images like 'vcs'

docker search <registry_host>:<registry_port>/vcs

Solution 7 - Docker

I installed the atc-/docker-registry-web project that gives me UI and search for my private registry. https://github.com/atc-/docker-registry-web

It is dockerised and you can just run it by

docker run -p 8080:8080 -e REG1=http://registry_host.name:5000/v1/ atcol/docker-registry-ui
and review contents by browsing to registry_ui_host.name:8080

Solution 8 - Docker

Currently AFAIK there is no easy way to do this as this information should be stored by index which private registry doesn't have. But depending on how you started registry you have 2 options:

  1. if you started registry without -v to store data in separate host folder you can try with docker diff <id_of_registry_container> with this you should get info about changes in container fs. All pushed images should be somewhere in /tmp/registry/repositories/
  2. if you started registry with -v just check content of mounted directory on host

If you used "centos" as name it should be in /tmp/registry/repositories/library/centos. This folder will contain text files which describes image structure. Actual data is in /tmp/registry/images/.

Solution 9 - Docker

Modifying the answer from @mre to get the list just from one command (valid at least for Docker Registry v2).

docker exec -it <your_registry_container_id> ls -a /var/lib/registry/docker/registry/v2/repositories/

Solution 10 - Docker

Another method in one line (substitute your actual path/ports if needed).

Example: Assume a generic registry:2.0 start up, the running registry container has a log file that holds images and tag names. I extrapolate the data like this:

grep -r -o "vars\.name=.* vars.reference=.*" /var/lib/docker/containers/* | cut -c 167-225 | sed 's/ver.*$//' | sed 's/vars\.name=//' | sed 's/ vars\.reference=/:/' | sort -u

You may need to tweak the cut values to get the output desired.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionedwardsbeanView Question on Stackoverflow
Solution 1 - DockeriTechView Answer on Stackoverflow
Solution 2 - DockersnthView Answer on Stackoverflow
Solution 3 - DockerfaideView Answer on Stackoverflow
Solution 4 - DockermreView Answer on Stackoverflow
Solution 5 - DockerMatthew RasmussenView Answer on Stackoverflow
Solution 6 - DockersmishraView Answer on Stackoverflow
Solution 7 - DockerLarisa SabbanView Answer on Stackoverflow
Solution 8 - DockerodkView Answer on Stackoverflow
Solution 9 - Dockeruser9269906View Answer on Stackoverflow
Solution 10 - DockerPhil PinkertonView Answer on Stackoverflow