Private docker registry that attempts a pull-through on images not found locally 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).
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.

proxy:
  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://&lt;my-docker-mirror-host&gt;"]
}