Trukhanov Nikolay
Trukhanov Nikolay

Reputation: 51

How to search for an docker image in multiple private registries

When we are searching for an image in our private registry we need to specify the host "docker search 10.10.10.10:5000/apache" If we execute "docker search apache" docker is looking for an image only in the official docher hub registry. Our use case:

FROM organization/apache
# .....
# custom instructions

We want to search this image in our registry(without providing registry host), and if it is not found use public docker hub registry. Is it possible to configure docker client to do this?

Upvotes: 5

Views: 3541

Answers (2)

Adrian Mouat
Adrian Mouat

Reputation: 46500

I think what you actually want to do is set up a Docker mirror: https://docs.docker.com/registry/recipes/mirror/

So the first time you pull an image, it will come from the Hub, but subsequent requests will be handled locally.

Upvotes: 2

user2915097
user2915097

Reputation: 32176

any docker command (docker ps or docker stats) is in fact a call to the docker API, so you can do, instead of a docker search apache a curl "http://docker.example.com:2375/images/search?term=apache" | python-mjson.tool so check the doc https://docs.docker.com/reference/api/docker_remote_api/ . Your script can first look with the previous curl command, test the result and if not found search the official registry hub http://registry.hub.docker.com/

Upvotes: 0

Related Questions