Multiple Ethernet port in docker container

I have two hardware interface on my host machine. I want to use both of these interface in all containers which I will create on host machine. So what is the best way to do that?
I tried these things:-

  1. I created container with default bridge network and then created one more bridge network with “docker network create -d bridge -o parent=host_interface bridge_name”. But when I attach it to container the default container interface stops working.

  2. I tried adding through pipework (sudo ./pipework “host_interface” “container_name” dhclient) also but no success.

So please suggest me how I can do that.
Thanks
Rohit

If you use the default Docker setup, I’m pretty sure the ordinary -p option will allow inbound traffic from all interfaces. (And -p 10.20.30.40:80:80 will bind to a specific address on a specific interface.)

The Docker networking documentation doesn’t really discuss multiple host interfaces at all, but it also doesn’t mention the -o parent option you use at all. My guess would be that private bridge networks work the same way as the default network and that -p listens on all host interfaces unless specifically restricted.

1 Like

Thank you so much David for reply.
I have two NIC eno1 (10…0.5.147) and eno2(10.0.5.184).
I want something like this
I want to map
10.0.5.147:random_port on host to 172.20.0.5:22 in docker container_1
10.0.5.184:random_port on host to 172.19.0.5:22 in docker container_1
So that I have two ip in docker container and if eno2 is not connected then 172.19.0.5:22 ip should not work.
Please help me with this.

Check your docker permissions in firewall.
And run your application on 0.0.0.0

Docker will share the same application in all your Ethernets