88

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 ? :)

1
  • i mean how to search images from private registry by command line or http May 20, 2014 at 4:13

10 Answers 10

93

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

3
87

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:

Listing Repositories (link)

GET /v2/_catalog

Listing Image Tags (link)

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"]}
0
74

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
3
19

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

1
  • if the docker exec -it <your_registry_container_id> bash command does not work then try docker exec -it <your_registry_container_id> /bin/sh
    – KurioZ7
    Nov 1, 2019 at 6:20
15

List all images

docker search <registry_host>:<registry_port>/

List images like 'vcs'

docker search <registry_host>:<registry_port>/vcs
13

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
4
  • 40
    With docker 1.8.1 on Ubuntu 14.04 I'm getting Error response from daemon: Unexpected status code 404, what's wrong? Aug 26, 2015 at 15:09
  • 4
    I have the same problem the command 'docker search repositroy_ip:5000/busybox' returns the 404, but previous command 'docker push repository_ip:5000/busybox' has succeeded
    – ksopyla
    Sep 29, 2015 at 7:31
  • 1
    you may need to use curl for insecure registries, e.g. curl --insecure -u "test:password" https://myregistrydomain.com:5000/v2/_catalog
    – Leon Mak
    May 29, 2019 at 10:27
  • "If you start your docker-registry without enabling search, then this UI won't work and it's not obvious why. I was able to add the registry just fine because docker-registry-host:5000/v1/ping returns HTTP 200, but when navigating to the Images the UI will report the "Registry is Unreachable" b/c docker-registry-host:5000/v1/search returns HTTP 404." github.com/atcol/docker-registry-ui/issues/…
    – sm4rk0
    Feb 3, 2020 at 12:40
5

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

2

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/.

2
  • sorry,i mean how to search images from private registry by command line or http May 20, 2014 at 4:11
  • Yes I know but AFAIK without index you can't search images in private registry. There is /v1/search api method in registry but it requires index backend. There is basic index implementation in private registry code ( github.com/dotcloud/docker-registry/blob/master/docker_registry/… ) but it's only to provide basic functions in standalone mode. Few days ago I found this: github.com/ekristen/docker-index but didn't have time to test is.
    – odk
    May 20, 2014 at 7:56
1

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/
1
  • Also for listing tags of a repository: docker exec -it <your_registry_container_id> ls -a /var/lib/registry/docker/registry/v2/repositories/postgresql/_manifests/tags Jul 22, 2020 at 7:12
0

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.