5

I have a program setup to remotely manage images & containers on various PCs on a local network. I'd like to be able to get a list of all images available on a registry as well. I have the IP of the registry machine and am looking for some command to list everything in that registry so I could sort by repository/tag.

Thanks for any help.

2 Answers 2

8

I suppose that you use latest v2 docker registry.

Docker Registry v2 has a well defined REST API .

For example, if you have a registry at location: registry.example.com:5000 and https proxy, you could use address: https://registry.example.com:5000/v2/_catalog to list all repositories.

Here is an example of listing first 100 repositories and its tags in registry. Note that pagination of repositories and tags needs to be done more carefully than in this quick example.

registry="registry.example.com:5000"
repos=`curl https://$registry/v2/_catalog?n=100 | jq '.repositories[]' | tr -d '"'`
for repo in $repos; do 
   curl https://$registry/v2/$repo/tags/list; 
done
2
  • Sorry for late response, I get curl: (77) error setting certificate verify locations I know the locations don't exist but as to why, I have no clue. I unfortunately don't have any knowledge in this type of thing. If I run curl with -k, I get curl: (35) error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol Any ideas on how to proceed? I feel as though this isn't enough information for you to really do anything. Mar 10, 2016 at 20:55
  • Turned out I didn't need https:// in front of this. I could just do localhost:5000/v2/_catalog?n=100 and it worked. Hope this might help somebody. Mar 17, 2016 at 11:54
0

While not a direct answer to find a list of images, you can list a specific image details with docker manifest inspect This was helpful for me finding if the image already existed or not. https://docs.docker.com/engine/reference/commandline/manifest_inspect/

Hopefully this helps someone. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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