Easy Setup OpenVPN Using Docker DockVPN

In this post we'll learn how to easily setup OpenVPN using dockvpn.

In the simplest terms, VPN creates a secure, encrypted connection, which can be thought of as a tunnel, between your computer and a server operated by the VPN service. Applications running across the VPN may therefore benefit from the functionality, security, and management of the private network

Installing OpenVPN is not easy job, lot of stuff need to be done. By using this DockVPN recipe, we can easily get the job done.

1. Install Git and Curl

If you haven't install git and curl, install both of them first.

$ apt-get update
$ apt-get install -y git-core curl

2. Instal Docker

Next we need to install Docker community edition. Follow installation guide based on your operating system.

In this post we choose Ubuntu as the OS.

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update
$ sudo apt-get install -y docker-ce

3. Instal Docker Compose

We need docker compose to start and run the dockvpn. The whole setup for the OpenVPN itself already handled by dockvpn.

$ sudo curl -L https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && \
$ sudo chmod +x /usr/local/bin/docker-compose

4. Instal DockVPN

Clone dockvpn from the repository, then run it using docker-compose command.

$ git clone https://github.com/jmarhee/dockvpn.git
$ cd dockvpn
$ docker-compose up -d

Please wait, this process might take few minutes.

5. Test the VPN

So now OpenVPN server is running in our server. Download the client.opvn config file from yourserverip:10889.

You can use any VPN client. For example on my computer, I use tunnelblick.

After connected to the VPN server, try to check your IP. My server is located on Singapore, so ideally my location info should changed to there as well.