Direct container traffic in and out of a specific nic on the host

Hi,

I am setteing up a container system where i need some containers to specifically communicate to the internete via a diffrentnt gateway. I have tried binding port to the ip address of the sendiond nic using the command below, but it has not worked.
ports:

  • “192.168.1.2:8080:8080”

my setup looks a little like this: (Diag borrowed from StackExchange link)

                                          +----------------+        /
                                          |                |       |
                            +-------------+ Gateway 1      +-------
                            |             | 192.168.1.254  |     /
                     +------+-------+     +----------------+    |
                     |     eth0     |                          /
                     | 192.168.1.6  |                         |
                     |              |                         |
                     | DOCKER HOST  |                         |
                     |              |                         | Internet
                     |   docker0    |                         |
                     |   (bridge)   |                         |
                     |  172.17.42.1 |                         |
                     |              |                         |
                     |     eth1     |                         |
                     |  192.168.1.8 |                         \
                     +------+-------+     +---------------+    |
                            |             |   HW  VPN     |     \
                            +-------------+ Gateway 2     +-------
                                          | 192.168.1.25  |       |
                                          +---------------+            

but all the traffic is going out of eth0

is the answer to setup a second bridge? if so can enyone provide the steps for doing it on Ubuntu.

Thanks
Maurice