# 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