nginx-proxy-auto-docker/test/test_separate_only_exposed/test_only-exposed.yml
Thomas LEVEIL 5c2f50402a fix template when running docker-gen and nginx in separate containers
Since commit 658e20f, the template makes the assumption that the container running docker-gen is the container running nginx while checking that upstream containers are reachable.
By introducint the `NGINX_CONTAINER` environment variable, users are now able to indicate which container is actually running nginx when running docker-gen and nginx in separated containers.
2017-03-08 21:32:54 +01:00

45 lines
No EOL
1.2 KiB
YAML

# In this compose file we define a dockergen container which is running the docker-gen process with the
# `-only-exposed` option. This should not be an issue since the template for the nginx config file should only
# have to deal with upstream containers which are required to have at least one port exposed, and since the nginx
# container with no exposed port makes no sense.
---
version: '2'
networks:
default: {}
volumes:
nginx_conf: {}
nginx_certs: {}
services:
nginx:
image: nginx
container_name: nginx
volumes:
- nginx_conf:/etc/nginx/conf.d
- nginx_certs:/etc/nginx/certs
dockergen:
image: jwilder/docker-gen
command: -notify-sighup nginx -only-exposed -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
volumes_from:
- nginx
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- nginx_conf:/etc/nginx/conf.d
- nginx_certs:/etc/nginx/certs
- ../nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl
environment:
NGINX_CONTAINER: nginx
web:
image: web
container_name: whoami
expose:
- "80"
environment:
WEB_PORTS: 80
VIRTUAL_HOST: whoami.nginx.container.docker