From 362c5e8a65b5b689700b011903d3853adaf5f6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Mon, 29 Feb 2016 18:40:14 +0000 Subject: [PATCH] Add Compose file for self-hosted registry --- registry/README.md | 37 +++++++++++++++++++++++++++++++++++++ registry/docker-compose.yml | 12 ++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 registry/README.md create mode 100644 registry/docker-compose.yml diff --git a/registry/README.md b/registry/README.md new file mode 100644 index 00000000..4dca5812 --- /dev/null +++ b/registry/README.md @@ -0,0 +1,37 @@ +# Docker Registry with Swarm superpowers + +To start your registry, just do: + +``` +docker-compose up -d +``` + +You can then refer to the registry as `localhost:5000`. + +If you are running on Swarm, do the following: + +``` +docker-compose up -d +docker-compose scale frontend=N +``` + +... where `N` is the number of nodes in your cluster. + +This will make sure that a `frontend` container runs on every node, +so that `localhost:5000` always refers to your registry. + +If you scale up your cluster, make sure to re-run `docker-compose scale` +accordingly. + +If you supply a too large value for `N`, you will see errors +(since Swarm tries to schedule more frontends than there are +available hosts) but everything will work fine, don't worry. + +Note: this will bind port 5000 on the loopoback interface on +all your machines. That port will therefore be unavailable if +you try e.g. `docker run -p 5000:...`. + +Note: the registry will only be available from your cluster, +through the loopback interface. If you want to make it available +from outside, remove `127.0.0.1:` from the Compose file. + diff --git a/registry/docker-compose.yml b/registry/docker-compose.yml new file mode 100644 index 00000000..2698cf2d --- /dev/null +++ b/registry/docker-compose.yml @@ -0,0 +1,12 @@ +version: "2" + +services: + backend: + image: registry:2 + frontend: + image: jpetazzo/hamba + command: 5000 backend:5000 + ports: + - "127.0.0.1:5000:5000" + depends_on: + - backend