5

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?

2 Answers 2

2

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.

2
  • I am not sure that answers the question. With a Docker mirror setup, will a search/pull for some/image search all of the configured mirrors + the official docker hub? I.e. is it even possible to refer to a private image on a private registry (with proprietary software that you cannot make public on docker hub) using just some/image or does it always have to include the registry hostname like my-private-registry.com/some/image ? Jul 25, 2018 at 21:03
  • This is an old question, but I guess I was trying to solve the problem rather than directly answer the question. I'm really not sure what docker search will do when a registry mirror is configured. Jul 27, 2018 at 9:05
0

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/

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.