mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-28 17:21:11 +00:00
Add Compose file for self-hosted registry
This commit is contained in:
37
registry/README.md
Normal file
37
registry/README.md
Normal file
@@ -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.
|
||||
|
||||
12
registry/docker-compose.yml
Normal file
12
registry/docker-compose.yml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user