Docker Community Forums

Share and learn in the Docker community.

Shouldn't "ports" be moved underneath "networks"?


(Jamshid) #1

A docker-compose.yml can define two separate networks. Then each service can be associated with one or both of those networks, meaning they’ll have an ip on that network and can talk to other containers on that network.

Shouldn’t ports be a property underneath each network? Currently, if you have a service on two networks and publish a port, I guess it will try to publish on both. In my case, I want to “publish” a port on only one network, but the service needs access to both networks.