Docker container not able to reach server through VPN

I have a machine with Ubuntu 18.04. In this machine I connect to our company’s server through openvpn

sudo openvpn --config config.ovpn --daemon

it works, I can reach any server behind the vpn.
Now, in this same machine I installed docker and pulled an image for our application. I can run the docker container but when I try to build our project from inside the container, it has to connect fetch some libraries in the server that is behind the vpn but the container is unable to resolve the address.

I read it was possible using the --net=host but this made no difference. I found this other post on reddit that suggests to do something with iptables. Is this the only way to go or is there something simpler that can solve my issue?

I have very limited knowledge about Docker, Im just learning on the fly.