Skip to content

Instantly share code, notes, and snippets.

@ohmydevops
Created May 11, 2021 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohmydevops/358c34017ece624a11a8181d6bb4dcb5 to your computer and use it in GitHub Desktop.
Save ohmydevops/358c34017ece624a11a8181d6bb4dcb5 to your computer and use it in GitHub Desktop.
Docker registry with Nginx and Let's Encrypt
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
@ohmydevops
Copy link
Author

Add this config to nginx-proxy/configs/default file:

client_max_body_size 100m;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment