Docker Community Forums

Share and learn in the Docker community.

Question: Docker Compose with static public IP over LAN but different with Host IP

(8kiwi8) #1

I have the requirement where I need to expose all my containers through a static public IP.
However, the static public IP cannot be host IP because host IP must be dynamic.

The 2 solutions I found is macvlan and linux secondary IP, but base on my understanding, they cannot fulfil my need.

with macvlan, each container will get individual IP. I need to access all container through the same IP.

with linux secondary IP, I can assign a single static IP which exclusive for my docker container. However, I didn’t found a way to manage the /etc/network/interface inside a docker container.

My question is:

  1. Is it possible to set all container using same ip using macvlan?
  2. Is there any way to manage/etc/network/interface, include ifup and ifdown inside a docker container?
  3. Is there any alternative method