Created
May 11, 2021 10:09
-
-
Save ohmydevops/358c34017ece624a11a8181d6bb4dcb5 to your computer and use it in GitHub Desktop.
Docker registry with Nginx and Let's Encrypt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
registry: | |
restart: always | |
image: registry:2.7.1 | |
container_name: registry | |
environment: | |
REGISTRY_AUTH_HTPASSWD_PATH: /auth/htpasswd | |
REGISTRY_AUTH_HTPASSWD_REALM: Registry Realm | |
REGISTRY_AUTH: htpasswd | |
REGISTRY_STORAGE_DELETE_ENABLED: "true" | |
LETSENCRYPT_HOST: YOUR_REGISTRY_URL (example: registry.example.com) | |
VIRTUAL_HOST: YOUR_REGISTRY_URL (example: registry.example.com) | |
VIRTUAL_PORT: 5000 | |
volumes: | |
- ./registry_data:/var/lib/registry | |
- ./auth:/auth | |
nginx-proxy: | |
restart: always | |
image: nginxproxy/nginx-proxy | |
container_name: nginx-proxy | |
ports: | |
- 0.0.0.0:80:80 | |
- 0.0.0.0:443:443 | |
volumes: | |
- ./nginx-proxy/certs:/etc/nginx/certs | |
- ./nginx-proxy/vhost.d:/etc/nginx/vhost.d | |
- ./nginx-proxy/html:/usr/share/nginx/html | |
- ./nginx-proxy/configs/default:/etc/nginx/vhost.d/default | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
nginx-proxy-acme: | |
restart: always | |
image: nginxproxy/acme-companion | |
container_name: nginx-proxy-acme | |
volumes: | |
- ./nginx-acme/acme:/etc/acme.sh | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
- ./nginx-proxy/certs:/etc/nginx/certs | |
- ./nginx-proxy/vhost.d:/etc/nginx/vhost.d | |
- ./nginx-proxy/html:/usr/share/nginx/html | |
environment: | |
DEFAULT_EMAIL: YOUR_EMAIL | |
NGINX_PROXY_CONTAINER: nginx-proxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this config to nginx-proxy/configs/default file: