Build docker behind VPN

Kyrremann picture Kyrremann · Mar 17, 2015 · Viewed 10.4k times · Source

At the project I am at now, we have Github Enterprise set up behind a VPN, so I use OpenVPN to connect with my desktop (Ubuntu 14.04 LTS), but when I try to build with Docker (using Centos6) I always get ssh: Could not resolve hostname github.xxx.xxx: Name or service not known.

I've looked at the Docker documentation, but it looks that it is only solving problem using Proxy or a Bridge, and Google only returns answers on how I can set up OpenVPN on a Docker image.

So then I turn to Stackoverflow and hope for an answer on how I can run sudo docker build image and get it to use my VPN to clone from Github.

Also, our Mac users have installed Boot2Docker, and have no problems building the image.

Answer

user3547202 picture user3547202 · Oct 5, 2020

I tried all kinds of things, in the end the simplest thins helped on Ubuntu 18.04. Stoping and starting docker deamon.

Prerequisites: VPN off

sudo systemctl stop docker

---> Start VPN

sudo systemctl start docker

Hope will help someone.