Use VPN connection from host

Hello,

I’m trying to solve the following problem.

Notes:

  • Docker For Mac 17.06.1-ce-rc1, build 77b4dce
  • docker-compose version 1.14.0, build c7bdf9e

I have a container that is running a rails application. The database that it needs to connect is hosted in an external server that I connect with a VPN. The VPN connection is handled by the host, not the container. When I try to use network_mode: “host” in my container, the VPN is not accessible because the interface that docker creates for the container is overlapping with my VPN network so the container is not able to route it correctly.

When I do ip l a in the container I get this interface:

252: br-aaf6730e3ef3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
    link/ether 02:42:9c:52:8b:07 brd ff:ff:ff:ff:ff:ff
    inet 172.24.0.1/16 scope global br-aaf6730e3ef3
       valid_lft forever preferred_lft forever
    inet6 fe80::42:9cff:fe52:8b07/64 scope link
       valid_lft forever preferred_lft forever

The server I need to connect to is using this address 172.19.50.9.

When I try to ping the server inside the container I get:

root@moby:/var/www/app# ping 172.19.50.9
PING 172.19.50.9 (172.19.50.9) 56(84) bytes of data.
From 172.19.0.1 icmp_seq=1 Destination Host Unreachable
From 172.19.0.1 icmp_seq=2 Destination Host Unreachable
From 172.19.0.1 icmp_seq=3 Destination Host Unreachable

Can anyone point me to a potential solution ?