docker-compose-nginx-proxy/docker-compose.yml

59 lines
1.5 KiB
YAML
Raw Permalink Normal View History

2020-03-28 20:37:15 +00:00
version: "3.7"
services:
nginx:
image: nginx:1.17.6-alpine
container_name: nginx
ports:
- 80:80
- 443:443
volumes:
- "nginx_certs:/etc/nginx/certs:z,ro"
- "nginx_vhostd:/etc/nginx/vhost.d:z"
- "nginx_html:/usr/share/nginx/html:z"
- "nginx_conf:/etc/nginx/conf.d:z"
networks:
- proxy
restart: always
nginx-proxy:
image: jwilder/docker-gen # no version can be specified...
command: -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
container_name: nginx-proxy
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:z,ro"
- ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl
- "nginx_certs:/etc/nginx/certs:z,ro"
- "nginx_vhostd:/etc/nginx/vhost.d:z"
- "nginx_html:/usr/share/nginx/html:z"
- "nginx_conf:/etc/nginx/conf.d:z"
depends_on:
- nginx-proxy-companion
networks:
- proxy
restart: always
nginx-proxy-companion:
image: jrcs/letsencrypt-nginx-proxy-companion:v1.12
container_name: nginx-proxy-companion
environment:
NGINX_PROXY_CONTAINER: "nginx-proxy"
NGINX_DOCKER_GEN_CONTAINER: "nginx"
volumes:
- "nginx_certs:/etc/nginx/certs:rw"
- "nginx_vhostd:/etc/nginx/vhost.d:z"
- "nginx_html:/usr/share/nginx/html:z"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
networks:
- proxy
restart: always
volumes:
nginx_certs:
nginx_vhostd:
nginx_html:
nginx_conf:
networks:
proxy:
name: proxy