{"action":"created","issue":{"url":"https://api.github.com/repos/jwilder/docker-gen/issues/196","repository_url":"https://api.github.com/repos/jwilder/docker-gen","labels_url":"https://api.github.com/repos/jwilder/docker-gen/issues/196/labels{/name}","comments_url":"https://api.github.com/repos/jwilder/docker-gen/issues/196/comments","events_url":"https://api.github.com/repos/jwilder/docker-gen/issues/196/events","html_url":"https://github.com/jwilder/docker-gen/issues/196","id":157004784,"number":196,"title":"no servers are inside upstream in `/etc/nginx/conf.d/default.conf:34`","user":{"login":"danielgroves","id":630539,"avatar_url":"https://avatars.githubusercontent.com/u/630539?v=3","gravatar_id":"","url":"https://api.github.com/users/danielgroves","html_url":"https://github.com/danielgroves","followers_url":"https://api.github.com/users/danielgroves/followers","following_url":"https://api.github.com/users/danielgroves/following{/other_user}","gists_url":"https://api.github.com/users/danielgroves/gists{/gist_id}","starred_url":"https://api.github.com/users/danielgroves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielgroves/subscriptions","organizations_url":"https://api.github.com/users/danielgroves/orgs","repos_url":"https://api.github.com/users/danielgroves/repos","events_url":"https://api.github.com/users/danielgroves/events{/privacy}","received_events_url":"https://api.github.com/users/danielgroves/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-26T15:00:34Z","updated_at":"2016-06-11T00:35:27Z","closed_at":null,"body":"I've been working on settings up a docker instance which will host multiple containers using jwilder/docker-gen, [jrcs/letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion) and the official nginx container. \r\n\r\nI've setup all of the containers [using these instructions](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion#separate-containers-recommended-method), however there seems to be an issue here which I _think_ is most likely related to docker-gen. I might be wrong here, and am happy to stand corrected. \r\n\r\nOnce all three containers are running I am launching a docker-registry container which listens on port 5000 which the following environment variables set:\r\n\r\n- `VIRTUAL_PORT=5000`\r\n- `VIRTUAL_HOST=registry.danielgroves.net`\r\n\r\nI've intentionally not set the lets encrypt environmental variables yet, as I'd like to get this working without before adding the additional complexity. When I hit the given URL I get a 503 back from nginx and when running `docker logs nginx` can see the that it can't see any upstream servers: `2016/05/25 10:40:47 [emerg] 1#1: no servers are inside upstream in /etc/nginx/conf.d/default.conf:34`.\r\n\r\nI've included the contents of the `default.conf` file at the bottom of this issue. \r\n\r\nAs far as I can tell docker-gen isn't picking up the container properly, despite registering the exposed port with it, and thus isn't populating the upstream block properly. I've probably done something stupid, but it would be great if someone could confirm. There's no errors in the logs for the docker-gem container, but I will include the output here as well. \r\n\r\nIs there something I'm missing? This is the full command I've used to launch my registry container:\r\n\r\n`docker run -d --name registry --restart always --expose 5000 -v /opt/registry:/etc/docker/registry:ro -e VIRTUAL_HOST=registry.danielgroves.net -e VIRTUAL_PORT=5000 registry_s3`\r\n\r\n**`default.conf`:**\r\n\r\n```\r\n# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the\r\n# scheme used to connect to this server\r\nmap $http_x_forwarded_proto $proxy_x_forwarded_proto {\r\n  default $http_x_forwarded_proto;\r\n  ''      $scheme;\r\n}\r\n# If we receive Upgrade, set Connection to \"upgrade\"; otherwise, delete any\r\n# Connection header that may have been passed to this server\r\nmap $http_upgrade $proxy_connection {\r\n  default upgrade;\r\n  '' close;\r\n}\r\ngzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;\r\nlog_format vhost '$host $remote_addr - $remote_user [$time_local] '\r\n                 '\"$request\" $status $body_bytes_sent '\r\n                 '\"$http_referer\" \"$http_user_agent\"';\r\naccess_log off;\r\n# HTTP 1.1 support\r\nproxy_http_version 1.1;\r\nproxy_buffering off;\r\nproxy_set_header Host $http_host;\r\nproxy_set_header Upgrade $http_upgrade;\r\nproxy_set_header Connection $proxy_connection;\r\nproxy_set_header X-Real-IP $remote_addr;\r\nproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\nproxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;\r\nserver {\r\n\tserver_name _; # This is just an invalid value which will never trigger on a real hostname.\r\n\tlisten 80;\r\n\taccess_log /var/log/nginx/access.log vhost;\r\n\treturn 503;\r\n}\r\nupstream registry.danielgroves.net {\r\n}\r\nserver {\r\n\tserver_name registry.danielgroves.net;\r\n\tlisten 80 ;\r\n\taccess_log /var/log/nginx/access.log vhost;\r\n\treturn 301 https://$host$request_uri;\r\n}\r\nserver {\r\n\tserver_name registry.danielgroves.net;\r\n\tlisten 443 ssl http2 ;\r\n\taccess_log /var/log/nginx/access.log vhost;\r\n\tssl_protocols TLSv1 TLSv1.1 TLSv1.2;\r\n\tssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;\r\n\tssl_prefer_server_ciphers on;\r\n\tssl_session_timeout 5m;\r\n\tssl_session_cache shared:SSL:50m;\r\n\tssl_certificate /etc/nginx/certs/registry.danielgroves.net.crt;\r\n\tssl_certificate_key /etc/nginx/certs/registry.danielgroves.net.key;\r\n\tssl_dhparam /etc/nginx/certs/registry.danielgroves.net.dhparam.pem;\r\n\tadd_header Strict-Transport-Security \"max-age=31536000\";\r\n\tinclude /etc/nginx/vhost.d/default;\r\n\tlocation / {\r\n\t\tproxy_pass http://registry.danielgroves.net;\r\n\t}\r\n}\r\n```\r\n\r\n**`docker-gen` logs:**\r\n\r\n```\r\n2016/05/25 10:40:47 Generated '/etc/nginx/conf.d/default.conf' from 2 containers\r\n2016/05/25 10:40:47 Sending container 'nginx' signal '1'\r\n2016/05/25 10:40:47 Watching docker events\r\n2016/05/25 10:40:47 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ''\r\n2016/05/25 10:41:16 Received event start for container 991b1d987b68\r\n2016/05/25 10:41:16 Received signal: hangup\r\n2016/05/25 10:41:16 Received signal: hangup\r\n2016/05/25 10:41:16 Generated '/etc/nginx/conf.d/default.conf' from 2 containers\r\n2016/05/25 10:41:16 Sending container 'nginx' signal '1'\r\n2016/05/25 10:41:21 Debounce minTimer fired\r\n2016/05/25 10:41:21 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ''\r\n2016/05/25 10:42:37 Received event die for container 60b6a7a736c5\r\n2016/05/25 10:42:37 Received event stop for container 60b6a7a736c5\r\n2016/05/25 10:42:42 Debounce minTimer fired\r\n2016/05/25 10:42:42 Generated '/etc/nginx/conf.d/default.conf' from 1 containers\r\n2016/05/25 10:42:42 Sending container 'nginx' signal '1'\r\n2016/05/25 10:44:57 Received event start for container 7a2b1fc74686\r\n2016/05/25 10:45:02 Debounce minTimer fired\r\n2016/05/25 10:45:02 Generated '/etc/nginx/conf.d/default.conf' from 2 containers\r\n2016/05/25 10:45:02 Sending container 'nginx' signal '1'\r\n2016/05/26 08:57:16 Received event die for container 7a2b1fc74686\r\n2016/05/26 08:57:16 Received event stop for container 7a2b1fc74686\r\n2016/05/26 08:57:17 Received event start for container 2ea8b67292d6\r\n2016/05/26 08:57:22 Debounce minTimer fired\r\n2016/05/26 08:57:22 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ''\r\n2016/05/26 09:00:27 Received event die for container 2ea8b67292d6\r\n2016/05/26 09:00:28 Received event stop for container 2ea8b67292d6\r\n2016/05/26 09:00:28 Received event start for container 81131159c395\r\n2016/05/26 09:00:33 Debounce minTimer fired\r\n2016/05/26 09:00:33 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ''\r\n2016/05/26 09:03:00 Received event die for container 81131159c395\r\n2016/05/26 09:03:00 Received event stop for container 81131159c395\r\n2016/05/26 09:03:01 Received event start for container 44867e65b8ff\r\n2016/05/26 09:03:06 Debounce minTimer fired\r\n2016/05/26 09:03:06 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification ''\r\n```"},"comment":{"url":"https://api.github.com/repos/jwilder/docker-gen/issues/comments/225325662","html_url":"https://github.com/jwilder/docker-gen/issues/196#issuecomment-225325662","issue_url":"https://api.github.com/repos/jwilder/docker-gen/issues/196","id":225325662,"user":{"login":"ninoles","id":772819,"avatar_url":"https://avatars.githubusercontent.com/u/772819?v=3","gravatar_id":"","url":"https://api.github.com/users/ninoles","html_url":"https://github.com/ninoles","followers_url":"https://api.github.com/users/ninoles/followers","following_url":"https://api.github.com/users/ninoles/following{/other_user}","gists_url":"https://api.github.com/users/ninoles/gists{/gist_id}","starred_url":"https://api.github.com/users/ninoles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ninoles/subscriptions","organizations_url":"https://api.github.com/users/ninoles/orgs","repos_url":"https://api.github.com/users/ninoles/repos","events_url":"https://api.github.com/users/ninoles/events{/privacy}","received_events_url":"https://api.github.com/users/ninoles/received_events","type":"User","site_admin":false},"created_at":"2016-06-11T00:35:27Z","updated_at":"2016-06-11T00:35:27Z","body":"OK, I have an idea and it happens to work (but I'm not sure why): I removed the -exposed-only from the docker-gen options and it starts working.  Note that:\r\n- The target docker has an exposed port\r\n- nginx-proxy work with exactly the same container\r\n\r\nFor reference, I test it with the following docker command:\r\ndocker run -d --expose=8000 -e VIRTUAL_HOST=<vhost> python:3.5 python -m http.server 8000"}}
{"actor":{"display_login":"ninoles"}}