Saturday, 15 March 2014

ubuntu - Build docker behind VPN -


I am still on this project, we have Gitub Enterprise installed behind VPN, so I use OpenVPN Desktop (Ubuntu 14.04 LTS), but when I try to make Docker (using Centos6) I always get the ssh: hostname github.xxx.xxx could not be resolved: name or service not known < / Code>.

I have seen the Docar document, but it seems that this is the only way to solve the problem using proxy or bridge, and answer how Google can set Open VPN only on a Docker Image .

Then I turn to Stackoverflow and how can I run sudo docker build image and answer it to use your VPN to clone it with Github I hope.

In addition, our Mac users have installed Boot2Docker, and there is no problem creating the image.

It is one of the two issues:

1) DNS

2) The routing table of your desktop

My specific case (Ubuntu 14.04) also turned out to be the routing table

docker run -i -t

If DNS is a problem, can you successfully ping the IP from within your container?

  docker run -i -t Ubuntu: 14.04 / bin / root Root @ 44445 Buffy 4e: / # Ping 8.8.8.8 Ping 8.8.8.8 (8.8.8.8) 56 (84) Data of Bytes 8.8.8.8 to 64 bytes: ICMP_sac = 1 ttl = 54 time = 8.8.8.8 to 64.1 ms64 bytes: icmp_sac = 2 ttl = 54 time = 75.6 ms  

if it works And you can not reach containers even when you are not connected to VPN, view your routes

Disconnect from VPN and inspect your routes with the route . Here's my output as an example:

  Use the destination gateway Janmask flag metric ref IFAS default DD-WR 0.0.0.0 UG 0 0 wlan0 172.17.0.0 * 255.255. 0.0 U 0 Docker 0 192.168 .1.0 * 255.255.255.0 U 9 wlan0 192.168.122.0 * 255.255.255.0 U 0 virbr0 There you will see the network of dockers ( 172.17.0.0 ). 

Now, join your VPN and re-issue the command. Your mileage may vary, but what I found was a duplicate entry in the root table:

  172.17.0.0 * 255.255.0.0 U 0 VPN 0 172.17.0.0 * 255.255.0.0 U 0 0 Docker 0  

The server was pushing a duplicate route!

In my case, I did not need those routes to navigate VPN successfully, so I found a way I used Open VPN to deactivate them, so I got down in the settings in the dialog Drill and 'ignore the routes automatically received'.

This is from the image.

Once I checked it and joined VPN, I had no duplicate entry now and my Docker Containers were able to connect to the Internet and became hosted inside VPN.


No comments:

Post a Comment