Bridged Containers Sharing the Same IP and Listening on Different Ports

May 18, 2019
231
15
38
Varies
Is it not possible for containers to share IPs at all? Should there be a /etc/netplan/config.yaml on Ubuntu Bionic containers?

INBOUND: If I have multiple containers sharing an IP, and these containers need to listen for incoming connections but there is no overlap in ports, how do I route these requests to the proper container? I would like to use bridging.

OUTBOUND: It seems that I can't even give multiple containers the same public IP using a bridge, the connection in the container is intermittent - even ping fails from time to time. There are no duplicate MAC addresses.

I already have security groups applied to each container with the ports they need to listen on. Outgoing policy is ACCEPT.
 
Is it not possible for containers to share IPs at all?
in any network setup only one host can have a single ip at one time

if you need one ip for multiple endpoints, you need either a (reverse) proxy (e.g. for http/s and multiple hosts) or a firewall that translates one ip/port combo to another (e.g. for non http/s and multiple ports)
 
  • Like
Reactions: Proxygen