Docker machine can't access internal network (VPN)

1.4k Views Asked by At

First, networking is not my strong suit so I apologize if my questions sounds dumb to those of you with the knows.

I'm running Ubuntu 16.04. I have a docker machine running postgres so that I can recreate a database easily for migrations. I need to pull in a foreign table from a database on my company's internal network but my docker machine can't access internal network servers. For example from my ubuntu terminal,

ping internal.server.company.com

returns with successful pings to the server (it's up). However,

docker exec -it ping internal.server.company.com

returns with unknown host. Also,

docker exec -it ping google.com

returns with successful pings so I know my docker machine can access the external internet.

Somehow traffic coming from docker can't access the internal network that my host can. Why is this and how can I get my docker machine talking to my internal network?

1

There are 1 best solutions below

1
On

I had similar issue and was able to resolve it by adding the extra host properties to docker-compose file. For example

extra_hosts:
    - "internal.server.company.com:172.162.4.111"