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 networknameNow when you run a container you add it to the network
docker run -d --net=networkname --name containername imagenameNow the /etc/hosts files will contain the addresses of the containers. So from another container you can reference "containername" as a hostname.
1OpenVPN 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