docker-compose-separate-containers.yml 911 B

12345678910111213141516171819202122232425262728
  1. volumes:
  2. nginx_conf:
  3. services:
  4. nginx:
  5. image: nginx
  6. container_name: nginx
  7. ports:
  8. - "80:80"
  9. volumes:
  10. - nginx_conf:/etc/nginx/conf.d:ro
  11. - network_internal.conf:/etc/nginx/network_internal.conf:ro
  12. dockergen:
  13. image: nginxproxy/docker-gen
  14. command: -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
  15. # the name "nginx" passed to the "-notify-sighup" flag must exactly match the container name used for the nginx container above.
  16. environment:
  17. # nginx-proxy environment variable (HTTP_PORT etc.) must be set on the docker-gen container (not the nginx container)
  18. volumes:
  19. - /var/run/docker.sock:/tmp/docker.sock:ro
  20. - ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl
  21. - nginx_conf:/etc/nginx/conf.d
  22. whoami:
  23. image: jwilder/whoami
  24. environment:
  25. - VIRTUAL_HOST=whoami.example