Setup VPN in docker

I am working on connecting docker containers together. I have explored the options provided in docker for networking. Now I want to create a VPN kind of setup to connect docker nodes and containers. Is there any way to establish a VPN.

2 Answers

As of version 1.9 (Nov 2015), Docker Networking is available.

Briefly you create a network

sudo docker network create networkname

Now when you run a container you add it to the network

docker run -d --net=networkname --name containername imagename

Now the /etc/hosts files will contain the addresses of the containers. So from another container you can reference "containername" as a hostname.

1

OpenVPN is the most common solution at the moment. This blog post should link you to everything you need to know, including working code

If that's not exactly what you're looking for, you can always enable SSH access between your containers and setup a simple VPN using SSH

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like