|
1 | | -# Traefik example |
| 1 | +# Single URL Docker Registry UI for Docker Swarm |
2 | 2 |
|
3 | | -Host the docker registry ui behind [traefik](http://traefik.io) with Docker Swarm mode. |
| 3 | +Swarm-compliant UI with public registry PULLs and authenticated registry PUSHes with Traefik v3. |
4 | 4 |
|
5 | | -## How to run |
| 5 | +## Features |
6 | 6 |
|
7 | | -Open a terminal console and type |
| 7 | +* Unauthenticated PULLs |
| 8 | +* Authenticated PUSH/DELETEs |
| 9 | +* Single URL (registry and ui on the same domain) |
| 10 | +* Let's Encrypt enabled |
| 11 | +* Authenticated Traefik Dashboard |
8 | 12 |
|
9 | | -```bash |
10 | | -bash run-swarm.sh |
| 13 | +## Introduction |
| 14 | + |
| 15 | +This configuration is designed to be a "single-serving" quickstart for homelab or development environment. |
| 16 | +It is built to be modular enough to easily break apart for larger or more production environments for the |
| 17 | +more advanced scenarios. |
| 18 | + |
| 19 | +It serves both a container registry and Joxit's Docker-Registry-UI on the same URL over HTTPS that can be |
| 20 | +secured with certificates from Let's Encrypt. The registry allows for public PULLs and authenticated PUSHes. |
| 21 | + |
| 22 | +Additionally, the **traefik** dashboard UI is published (although you do not need it during production) on |
| 23 | +port 8443 because [traefik hardcodes](https://doc.traefik.io/traefik/operations/api/#dashboard) the paths |
| 24 | +`/dashboard` and `/api`, plus it is just good practice to logically separate your administrative endpoints. |
| 25 | + |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +### Internet-Facing |
| 29 | + |
| 30 | +As committed, this uses Let's Encrypt for certificates, so port `:443` must be forwarded to your swarm to |
| 31 | +use the TLS challenge. |
| 32 | + |
| 33 | +[!WARNING] |
| 34 | +By default, you are set to use Let's Encrypt production certificate environment. During testing, you are |
| 35 | +advised to use the staging environment so you are not locked out from generating certificates due to a |
| 36 | +misconfiguration. |
| 37 | + |
| 38 | +### `.env` File |
| 39 | + |
| 40 | +The `.env` file makes it easy to perform all the replacements necessary. |
| 41 | + |
| 42 | +[!TIP] |
| 43 | +You may opt to find and replace the variables in the yaml file rather than relying on environment variables. |
| 44 | + |
| 45 | +```shell |
| 46 | +# Name of the stack within docker swarm |
| 47 | +STACK=registry |
| 48 | +# Name of the domain to register with traefik |
| 49 | +DOMAIN=contoso.com |
| 50 | +# Leave blank if not using Let's Encrypt |
| 51 | +RESOLVER=letsencrypt |
| 52 | +# Email address for Let's Encrypt |
| 53 | + |
| 54 | +``` |
| 55 | + |
| 56 | +## Uppies |
| 57 | + |
| 58 | +[!WARNING] |
| 59 | +Ensure that you have loaded the variables (e.g. `source .env` ) before bringing up the stack. |
| 60 | + |
| 61 | +```shell |
| 62 | +❯ docker stack deploy -c swarm.yml $STACK |
| 63 | +Creating network registry_frontend |
| 64 | +Creating service registry_traefik |
| 65 | +Creating service registry_redis |
| 66 | +Creating service registry_registry |
| 67 | +Creating service registry_ui |
| 68 | +Creating service registry_error-pages |
11 | 69 | ``` |
12 | 70 |
|
13 | | -## Authentication |
| 71 | +### Accounts |
| 72 | + |
| 73 | +#### dashboard |
| 74 | + |
| 75 | +Traefik's dashboard account is: |
| 76 | + |
| 77 | +* Username: `admin` |
| 78 | +* Password: `hunter2` |
| 79 | + |
| 80 | +#### registry |
14 | 81 |
|
15 | | -The registry is protected via __Basic authentication__ but feel free to use whatever you like. |
16 | | -In this sample, credentials are: **admin / admin**. |
| 82 | +The registry account is: |
17 | 83 |
|
18 | | -To generate a new password for basic auth, run the command: `htpasswd -nb username password`. |
| 84 | +* Username: `user` |
| 85 | +* Password: `hunter2` |
19 | 86 |
|
20 | 87 | ## Contributors |
21 | 88 |
|
22 | | -Thank you [@onizet](https://github.com/onizet) for this example. |
| 89 | +* [@jnovack](https://github.com/jnovack) |
| 90 | +* [@agahkarakuzu](https://github.com/agahkarakuzu) |
| 91 | +* [@onizet](https://github.com/onizet) |
0 commit comments