[TriLUG] Docker: network bridging with separate interfaces
Ron Kelley via TriLUG
trilug at trilug.org
Mon Apr 17 14:29:05 EDT 2017
Greetings all,
Started working on docker recently for a side project, and I have hit a road block. Hoping someone from the TriLUG might be able to help.
I have a server (VM - Ubuntu 16.04) running docker 2.12 with two network interfaces (eth0 and eth1). Per the docker details online, all traffic to/from the containers go across the docker0 bridge, which evidently, always goes over eth0 (or default GW from the best I can understand from the online readings). My goal is to dedicate eth0 as the management interface and use eth1 for all docker container traffic.
I read about using the “brctl” command to create a new bridged interface specifying a particular interface. However, this does not appear to work. I created the new bridge interface, spun up a test container using the new bridged interface, shutdown the physical interface on the host, and ran a traffic tool (ping). I expected traffic to stops since the bridge’s physical interface was down. Unfortunately, the traffic still goes on via eth0. Here are the commands I used:
----------------------
brctl addbr QA_Bridge eth1
docker network create -d bridge --subnet=192.168.1.0/24 --ip-range=192.168.1.0/24 --gateway=192.168.1.1 -o com.docker.network.bridge.name=QA_Bridge QA_Bridge
docker run —network QA_Bridge -d -p80:80 nginx/nginx
----------------------
I have spent a ton of time looking over online examples, but still can’t figure out how to get this done. Again, I want to use eth0 for server management only and use eth1 for data traffic.
Any help/pointers/clues?
Thanks.
More information about the TriLUG
mailing list