Docker Community Forums

Share and learn in the Docker community.

Handling multiple projects/containers which expose same ports

docker

(Jure Zvelc) #1

Expected behavior

On Linux I can create separate bridge network (using docker-compose) for each project. For example:
subnet: 10.10.148.0/24
gateway: 10.10.148.1
bind: 10.10.148.1
Docker creates a separate interface for this network and binds all container ports to this address. This way I can have multiple projects which expose same ports on different networks.

I am facing the same issue with virtualbox and docker-machine. As a workaround I can create a separate VM for each project.

How to handle multiple projects/containers which expose same ports with Docker for Mac since I can’t use multiple networks?

Actual behavior

Currently only one interface is created (for xyve VM, e.g. 192.168.64.1). Bridged networks defined in compose are created inside VM and are unreachable from host.

Information

Interface (from ifconfig):

bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=3<RXCSUM,TXCSUM>
ether 82:e6:50:22:05:64
inet 192.168.64.1 netmask 0xffffff00 broadcast 192.168.64.255
Configuration:
	id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
	maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
	root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
	ipfilter disabled flags 0x2
	member: en4 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 10 priority 0 path cost 0
	nd6 options=1<PERFORMNUD>
	media: autoselect
	status: active

(Jure Zvelc) #2

This might actually be a duplicate of [Multiple VMs](Feature Request: Multiple VMs](Feature Request: Multiple VMs). I guess there is no way to access bridged networks inside VM?