{"action":"opened","issue":{"url":"https://api.github.com/repos/docker/compose/issues/4375","repository_url":"https://api.github.com/repos/docker/compose","labels_url":"https://api.github.com/repos/docker/compose/issues/4375/labels{/name}","comments_url":"https://api.github.com/repos/docker/compose/issues/4375/comments","events_url":"https://api.github.com/repos/docker/compose/issues/4375/events","html_url":"https://github.com/docker/compose/issues/4375","id":202620705,"number":4375,"title":"Exposing ports of a service running on multiple networks.","user":{"login":"soulne4ny","id":1086596,"avatar_url":"https://avatars.githubusercontent.com/u/1086596?v=3","gravatar_id":"","url":"https://api.github.com/users/soulne4ny","html_url":"https://github.com/soulne4ny","followers_url":"https://api.github.com/users/soulne4ny/followers","following_url":"https://api.github.com/users/soulne4ny/following{/other_user}","gists_url":"https://api.github.com/users/soulne4ny/gists{/gist_id}","starred_url":"https://api.github.com/users/soulne4ny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soulne4ny/subscriptions","organizations_url":"https://api.github.com/users/soulne4ny/orgs","repos_url":"https://api.github.com/users/soulne4ny/repos","events_url":"https://api.github.com/users/soulne4ny/events{/privacy}","received_events_url":"https://api.github.com/users/soulne4ny/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-23T19:00:20Z","updated_at":"2017-01-23T19:00:20Z","closed_at":null,"body":"The following configuration runs nginx as reverse proxy on two bridge networks. It handles https and redirects http to https for requests from the internet.\r\n```\r\nversion: '2.0'\r\nservices:\r\n    nginx:\r\n         image: prod-nginx\r\n        ports:\r\n            - '80:80'\r\n            - '443:443'\r\n        networks:\r\n             a_front:\r\n             default:\r\n    # Other services defined as well.\r\nnetworks:\r\n    a_front:  # requests from the world\r\n        ipam:\r\n            config:\r\n              - subnet: 172.31.xx.xx/xx\r\n                gateway: 172.31.xx.xx\r\n    default:  # inner request\r\n        ipam:\r\n            config:\r\n              - subnet: 172.18.xx.xx/xx\r\n                gateway: 172.18.xx.xx\r\n```\r\nThere is no need to run https on internal interface. And nginx is able to handle requests differently depending on interface where request comes from. Therefore it needs to know exact ip for each interface, which can be defined on start using scripts.\r\nHowever world requests should be routed to the interface where nginx expect them, and internal requests too.\r\n\r\nI've found that ports 80 and 443 are mapped to the first network in alphabetical order. That's why network _front_ is named **_a_front_**.\r\n\r\nBut I haven't found in the docs that it should be so. \r\nIt is not neither obvious, nor explicit.\r\n\r\nIf it is true about alphabetical order, it should be stated clearly in the docs.\r\nThere be better an explicit way to specify ports on particular network, not on service top-level.\r\n\r\n**Versions**\r\n```\r\ndocker-compose version 1.9.0, build 2585387\r\n```\r\n```\r\nDocker version 1.12.6, build 78d1802\r\n```\r\n```\r\nLinux me.local 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux\r\n```\r\n"}}
{"actor":{"display_login":"soulne4ny"}}