Docker Registry Local Mirror

Why I needed it

I recently started working on some personal projects to do and learn things that I had in my TODO list for a very long time.
One of the moments when I work on them is during my (long) commuting times when I go to the office or somewhere else by train.
In order to get my docker images I need internet connection provided by my phone and it brings a couple of problems:

When docker images are new, there is no way to escape it, but I usually use the same docker images for the same projects. Once they
are downloaded there is no problem but I like keeping the amount of images in my system under control, so I want to be able to do:

docker rmi -f $(docker images -aq)

often.

I thought that it would be cool to have a mirror of the docker registry with the images I use so I can keep running this command and pull the images
from my computer.

That's why I decided to try out and add a docker registry mirror on my machine. And it turned out much easier than I expected.

How it works

me~/project$ docker pull ubuntu docker daemon mirror:5000 cached imageslocal disk Docker Hub

The docker daemon is configured to pull through the mirror, and the mirror keeps every image it serves on local disk:

How can you use it

The code and the explanation on how to use it can be found in the docker-registry-mirror repository.

Happy (and low data usage) programming!