In this article we setup a docker proxy (AKA mirror) in your lan, which will cache every image downloaded by their clients.
We'll cover how to install a docker registry somewhere in your LAN, and how to configure the clients to use this registry as a proxy.
First of all, we need a machine meeting these requirements:
- docker installed and running (because we love docker)
- have enough space to host all required images
Some suitable example are:
- A dedicated linux machine
- A NAS capable of running docker
- A spare raspberry pi, maybe with an external storage
For the sake of this article, let's presume we're dealing with a dedicated linux machine. We're not covering how to install docker, because you're adult and you're supposed to be capable of googling.
Let's create the storage directories for the registry container:
We also need the original config file for the registry:
For reference, the original config.yml should be something like this:
Now edit that file and add these lines at the end:
Time to start the registry:
- we're using HTTP (so, without encryption) on port 5000
- we're not using authentication
But all that's ok because it's only a proxy
Now, for each client you want to modify /etc/docker/daemon.json:
REMEMBER: replace 192.168.1.100 with the IP address of your docker proxy.
Then restart docker:
Now, every time you use docker, you're downloading from the local LAN proxy; if the image has been already downloaded, you should get it at LAN speed!
Download a big image:
This image is about half a GB in size.
Then delete it:
Then download it again:
and enjoy the speed increment!