Docker Community Forums

Share and learn in the Docker community.

Multiple Ethernet port in docker container

(Rohitsukhwal) #1

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.

(David Maze) #2

If you use the default Docker setup, I’m pretty sure the ordinary -p option will allow inbound traffic from all interfaces. (And -p 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.

(Rohitsukhwal) #3

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