Unable To Access Hosts Over VPN With Docker Installed in Vagrant Box


I’ve setup a Vagrant box (hashicorp/bionic64) with Docker, and docker-compose provisioned using the vagrant-docker-compose plugin. My host machine is connected to a VPN using OpenVPN.

Post vagrant up I’m unable to access VPN hosts from the Vagrant box (the internet remains accessible). The hostname gets resolved to an IP address, but then I see the following error message:

vagrant@vagrant:~$ ping foo.in-my-vpn.com
PING foo.in-my-vpn.com ( 56(84) bytes of data.
From vagrant ( icmp_seq=1 Destination Host Unreachable

I suspect that this has something to do with Docker networking - I am able to access these hosts if I don’t provision Docker in the VM.

I’ve faced a similar problem with Docker in the host, and solved by adjusting the bridge network IP as follows in /etc/docker/daemon.json:

  "bip": ""

I tried doing the same inside the VM, but it did not work. My knowledge of networking is rudimentary, and I’m not able to find much help on this topic. Any ideas would be very welcome.


Problem solved.