0

I've set up a docker registry and I've pushed a project called hellodocker into it. On another machine, I've logged in to my registry but when I try to pull, I have to use the full name: mydockerregistry.com/hellodocker.

Is there a way to configure docker to include my registry as a place it can download Not Found images from?

  • Don't forget that your local system is a pseudo repository too, and is addressed without the prefix... so the two would become confused / difficult to work with. – Attie Jul 16 at 18:16
2

I wouldn't recommend it for this purpose, but you can configure the docker engine with a registry mirror setting. From the dockerd CLI, that's the --registry-mirror flag. Or in /etc/docker/daemon.json, you can set:

{ "registry-mirrors": ["https://mydockerregistry.com"] }

When configuring the daemon.json, you'll need to reload the docker engine after applying the change. In the desktop GUI, this is an option on the screen. From Linux, you'll run systemctl reload docker.

This comes with two caveats:

  1. The registry mirror is polled first, then the upstream docker hub is polled for an image on any failure. If the mirror responds with a bad or old image, the docker engine will gladly use it.

  2. Images without a repository prefix come from the docker library, and the mirror will be searched for mydockerregistry.com/library/hellodocker rather than mydockerregistry.com/hellodocker. Therefore you'll need to:

    docker tag hellodocker:latest mydockerregistry.com/library/hellodocker:latest
    docker push mydockerregistry.com/library/hellodocker:latest
    

I've got a presentation covering mirroring and caching you may find useful at:

| improve this answer | |
  • Hmmm, it comes with some caveats. Maybe I won't do it. – Corey Ogburn Jul 16 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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