https://github.com/zakame/docker-registry-compose
Docker Registry: Hub Mirror and Local Private
https://github.com/zakame/docker-registry-compose
docker-compose docker-registry
Last synced: about 1 year ago
JSON representation
Docker Registry: Hub Mirror and Local Private
- Host: GitHub
- URL: https://github.com/zakame/docker-registry-compose
- Owner: zakame
- Created: 2017-12-23T07:07:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-05T04:38:17.000Z (over 8 years ago)
- Last Synced: 2025-04-09T23:50:37.843Z (about 1 year ago)
- Topics: docker-compose, docker-registry
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+TITLE: Docker Registry -- Hub Mirror and Local Private
* About
This is a simple Docker Compose system that lets one run 2 Docker
Registries on the same system:
- A Registry acting as a mirror for the Docker Hub
- A Registry for private images, meant for local development and
sharing between Docker hosts (including localhost as well as Docker
Machines and Minikube)
* How to use
Launch this just like any Compose system:
#+BEGIN_SRC sh
docker-compose up -d
#+END_SRC
Then, update your Docker host's =dockerd= configuration to run with the
=--registry-mirror= and =--insecure-registry= options. For example, on
systems using =/etc/default/docker= for configuration:
#+BEGIN_SRC sh
# on systems using /etc/default/docker
DOCKER_OPTS="--registry-mirror=http://127.0.0.1:50000 --insecure-registry=192.168.42.1:50001"
#+END_SRC
And for systems using =/etc/docker/daemon.json=:
#+BEGIN_SRC json
{
"insecure-registries": ["192.168.42.1:50001"],
"registry-mirrors": ["http://127.0.0.1:50000"]
}
#+END_SRC
The containers are configured to always restart, so one just needs to
do this initial setup once, and it will retain across Docker host
reboots.
* Tips & Tricks
** Using the same Registries across Docker Machines
My reference setup is a 6-node Docker Machine setup that I will
configure into a Docker Swarm later. Since I'm using a libvirt/KVM
setup where my main Docker Engine is on =192.168.122.1=, I can set up
my VMs like this:
#+BEGIN_SRC sh
for m in swarm-{manager,worker}-{1,2,3}; do
docker-machine create ... \
--engine-registry-mirror=http://192.168.122.1:50000 \
--engine-insecure-registry http://192.168.122.1:50001 $m
done
#+END_SRC
** Using external directories for registry volumes
If you wish to use your host's directory for storing registry data
instead of letting Compose make a named volume for you, just change
the volumes settings of the registry containers. For example:
#+BEGIN_SRC yaml
services:
registry_mirror:
...
volumes:
- /my/mirror/directory:/var/lib/registry
#+END_SRC
* See Also
- [[https://zakame.net/blog/2017/12/composing-a-docker-hub-mirror-and-private-registry.html][Zakame::Blog - Composinga Docker Hub Mirror and Private Registry]]
- [[https://zakame.net/blog/2017/07/mirroring-the-docker-hub.html][Zakame::Blog - Mirroring the Docker Hub]]
* License
The MIT License (MIT)
Copyright (C) Zak B. Elep.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.