I have a docker registry image running on a local network with the command

docker run -d -p 5000:5000 --restart=unless-stopped --name registry -v /mnt/part_sdb/registry:/var/lib/registry registry:2

but enabling the caching of images stored in Docker Hub requires one to pull the image, and push it in the local registry

Is there a way to configure the docker registry to do automatic pull-through if the image requested is not available locally while preserving the ability to push local images?

from this article:

The catch is that you will probably run the public Registry as a mirror or as a regular registry, so you will probably end up running two containers — one as a mirror, another as your local Registry (not a big deal). In artifactory you can set up as many registries as you want (local or remote), each with its own URL. Or you can “mix” them on a single URL with a virtual registry (if you think it is a good idea).

1 Answer 1


Yes, it is possible. The entire subject is discussed in Registry as a pull through cache, from where the below quotes are taken.

Basically you need to configure the cache as a proxy for Docker Hub:

Configure the cache

To configure a Registry to run as a pull through cache, the addition of a proxy section is required to the config file.

In order to access private images on the Docker Hub, a username and password can be supplied.

  remoteurl: https://registry-1.docker.io
  username: [username]
  password: [password]

Of course, you also need to configure your docker daemon to use your local cache (but I presume that may be already done from the context of the question):

Configure the Docker daemon

Either pass the --registry-mirror option when starting dockerd manually, or edit /etc/docker/daemon.json and add the registry-mirrors key and value, to make the change persistent.

  "registry-mirrors": ["https://<my-docker-mirror-host>"]
  • ok this does not solve the problem, as apparently you have to choose between configuring the registry as a mirroring cache or as a local registry. When it is configured as a mirroring cache, pushing local images is disabled
    – lurscher
    Nov 9, 2017 at 1:12
  • Right - it wouldn't be a mirroring cache if it would contain images not found in what it's mirroring... But your question update addresses that, I think. Nov 9, 2017 at 3:00

Your Answer

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

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