Docker Community Forums

Share and learn in the Docker community.

Openvpn and Docker/Containers

Hello Com,

im new to Docker and have some problems / quest.
On my host system Debian 10 i have installed openvpn and create a connection to an vpn. So when the vpn is running i cant install docker. Disabled it install it all fine. So when i activate vpn again i cant create containers.

So now what should i do ? I need for some Containers the vpn, so all that traffic should go though my vpn.

Should i create a container with openvpn and let the other containers go through that openvpn container for example this way ?

or should i use the openvpn on the host and make something like THIS?

Greet’s
Dockernewcomer

https://docs.linuxserver.io/images/docker-wireguard

Docker is moving fast and Ubuntu’s long term support (LTS) policy doesn’t keep up. To work around this we’ll install a PPA that will get us the latest version of Docker.

Add the upstream Docker repository package signing key. The apt-key command uses elevated privileges via sudo, so a password prompt for the user’s password may appear:

curl -L https://get.docker.com/gpg | sudo apt-key add -
Note: Enter your sudo password at the blinking cursor if necessary.

Add the upstream Docker repository to the system list:

echo deb http://get.docker.io/ubuntu docker main | sudo tee /etc/apt/sources.list.d/docker.list
Update the package list and install the Docker package:

sudo apt-get update && sudo apt-get install -y lxc-docker
Add your user to the docker group to enable communication with the Docker daemon as a normal user, where sammy is your username. Exit and log in again for the new group to take effect:

sudo usermod -aG docker sammy
After re-logging in verify the group membership using the id command. The expected response should include docker like the following example:

uid=1001(test0) gid=1001(test0) groups=1001(test0),27(sudo),999(docker)
Optional: Run bash in a simple Debian Docker image (–rm to clean up container after exit and -it for interactive) to verify Docker operation on host:

docker run --rm -it debian:jessie bash -l
Expected response from docker as it pulls in the images and sets up the container:

Unable to find image ‘debian:jessie’ locally
debian:jessie: The image you are pulling has been verified
511136ea3c5a: Pull complete
36fd425d7d8a: Pull complete
aaabd2b41e22: Pull complete
Status: Downloaded newer image for debian:jessie
root@de8ffd8f82f6:/#
Once inside the container you’ll see the root@:/# prompt signifying that the current shell is in a Docker container. To confirm that it’s different from the host, check the version of Debian running in the container:

cat /etc/issue.net
Expected response for the OpenVPN container at the time of writing:

Debian GNU/Linux jessie/sid
If you see a different version of Debian, that’s fine.

Exit the container by typing logout, and the host’s prompt should appear again.

My vpn did not have this protocol, so i cant use it.

oh my good, that sounds very difficult. After this docker should work through my vpn ?

I have it installed this way.