.env
file:
DEFAULT_HOST=example.com
DEFAULT_EMAIL=yourname@example.com
Create network:
docker network create nginx-proxy
Launch:
docker-compose up -d
version: '3' | |
services: | |
nginx-proxy: | |
image: jwilder/nginx-proxy | |
container_name: nginx-proxy | |
ports: | |
- "80:80" | |
- "443:443" | |
volumes: | |
- /var/run/docker.sock:/tmp/docker.sock:ro | |
- certs:/etc/nginx/certs:ro | |
- vhosts:/etc/nginx/vhost.d | |
- html:/usr/share/nginx/html | |
restart: always | |
environment: | |
- DHPARAM_GENERATION=false | |
letsencrypt-nginx-proxy-companion: | |
image: jrcs/letsencrypt-nginx-proxy-companion | |
container_name: letsencrypt | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
- certs:/etc/nginx/certs:rw | |
- vhosts:/etc/nginx/vhost.d | |
- html:/usr/share/nginx/html | |
restart: always | |
environment: | |
- DEFAULT_EMAIL=${DEFAULT_EMAIL} | |
cadvisor: | |
image: google/cadvisor:latest | |
container_name: health | |
volumes: | |
- /:/rootfs:ro | |
- /var/run:/var/run:rw | |
- /sys:/sys:ro | |
- /var/lib/docker/:/var/lib/docker:ro | |
restart: always | |
environment: | |
- VIRTUAL_HOST=health.${DEFAULT_HOST} | |
- VIRTUAL_PORT=8080 | |
- LETSENCRYPT_HOST=health.${DEFAULT_HOST} | |
watchtower: | |
image: v2tec/watchtower | |
container_name: watchtower | |
command: --debug | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- /root/.docker/config.json:/config.json | |
restart: always | |
volumes: | |
certs: | |
vhosts: | |
html: | |
networks: | |
default: | |
external: | |
name: nginx-proxy |