I have a server (let's name it A) which may have access to internet and from which I'm able to pull images from the officiel docker.io registry.
I also have other servers (B, C) which cannot have this same access for security reasons, but are allowed to have access to A.
I also have decided to install a private registry on A, which can be used from B and C.
Is it possible to have this registry acting as a proxy, in the way that when I want to pull an official image from B, it could be done through A ?
Step 1: Run registry version 2+ with proxy configuration
You need to run docker registry with a proxy configuraiton.
To get an initial
config.yml
:Add following to
config.yml
:Then start docker registry with
config.yml
:Step2: Configure Docker Daemon on client
If you use Docker for Mac (not Docker toolbox or boot2docker), just add
http://<proxy-ip>:5000
to mirrors section under Advanced tab:Restart Docker for Mac.
Otherwise, you need to run docker daemon with
--registry-mirror=http://<proxy_ip>:5000
, by doing something like following on the client or Docker Toolbox VM:Step 3: Verify proxy is working:
Try to pull an image you don't have yet:
Then verify proxy catalog has the new image:
It should return something including the image you have just pulled.