Free VPN in 1 minute with Docker
In this short guide I will show you how to quickly install an OpenVPN server using an existing Docker image. It is possible to install an OpenVPN server, but with Docker everything is much easier. You don't need to buy a third party service, everything is completely free.
You must have your own VPS server. If not, you can buy a VPS on DigitalOcean. You can buy the least expensive from $2 to $5 per month.
I will use an off-the-shelf VPN solution built on Docker: https://github.com/kylemanna/docker-openvpn
All you need for the first step is to install Docker. I use Ubuntu OS.
If Docker is installed, let's move on to the next step.
I will use the following variables:
ovpn-data-example-uk - It is for data volume container.
vpn.yourdomain.com - The value should be a domain name or IP Address.
uk.vpn.yourdomain.com - It’ll be used as a client definition.
These variables are test variables. You must use your variables.
Let’s begin by creating docker volume.
docker volume create --name ovpn-data-example-uk
The next step is to initialize the container.
docker run \ -v ovpn-data-example-uk:/etc/openvpn \ --log-driver=none \ --rm \ kylemanna/openvpn \ ovpn_genconfig \ -u udp://vpn.yourdomain.com
The container will ask you for a passphrase to protect the private key used by the newly generated certificate authority.
docker run \ -v ovpn-data-example-uk:/etc/openvpn \ --log-driver=none \ --rm \ -it \ kylemanna/openvpn \ ovpn_initpki
After the previous process finished, we can start the OpenVPN server process.
docker run \ -v ovpn-data-example-uk:/etc/openvpn \ -d \ -p 1194:1194/udp \ --cap-add=NET_ADMIN \ kylemanna/openvpn
We can generate a client certificate without a passphrase to be used on our local machine.
docker run \ -v ovpn-data-example-uk:/etc/openvpn \ --log-driver=none \ --rm \ -it \ kylemanna/openvpn \ easyrsa build-client-full uk.vpn.yourdomain.com nopass
After the certificate created, we can retrieve the client configuration with embedded certificates file.
docker run \ -v ovpn-data-example-uk:/etc/openvpn \ --log-driver=none \ --rm \ kylemanna/openvpn \ ovpn_getclient uk.vpn.yourdomain.com > uk.vpn.yourdomain.com.ovpn
Comments
Leave a comment: