# docker-puller This implements a docker images proxy on your local network. In fact, you need to start a local registry and run this script to fetch the images (instead of docker pull). ``` ./docker-puller.sh ubuntu:18.04 ``` This script will: - check if the image exists on the official docker registry - check if the image exists on the local registry - if so, it will download the image from the local registry - download the image from the official registry - update the image on the local registry If the local registry image is the same, the download will finish instantly, otherwise the local image will be used as a base to speedup the download. ## Dependencies Be sure to have these dependencies installed: ``` sudo apt install -y curl grep coreutils docker-ce-cli ``` It's very likely that you already have these installed. ## Configuration Just edit the script and set these variables: ``` REGISTRY=127.0.0.1:5000 PROTOCOL=http ``` They should point to the correct registry, probably on a machine in your local network. ## Configure the registry If you want to start a registry container on a machine on a local network, you just need to run the following on that machine: ``` $ docker run -d -p 5000:5000 --restart=always --name registry registry ``` For more info, take a look at this: [Deploying a docker registry](https://docs.docker.com/registry/deploying/) ## Allow docker to use an insecure registry If you don't have SSL in front if your registry (that's usually the case for local registries), then you probably need to tell the docker daemon on your machine to allow an "insecure" registry. Just edit ```/etc/docker/daemon.json``` like this: ``` { "insecure-registries" : ["127.0.0.1:5000"] } ``` For more info, take a look at this: [Test an insecure registry](https://docs.docker.com/registry/insecure/)