Install OpenVPN Access Server using Docker – Private VPN Server

Driven by the need of a more secure internet, and better encryption, more and more people are setting up their own VPN servers. OpenVPN Access Server is a full featured tunneling service that allows you to run a OpenVPN server with a simplified OpenVPN Connect interface. After installing and configuring OpenVPN Access Server you will be able to connect using clients supported on a wide range of operating systems, like Windows, MAC OS X, Linux, Android and iOS and start enjoying a more secure internet and complete privacy.
Must Read: Docker Media Server Ubuntu: Compose for 23 Awesome Apps

For those new to VPN, know that a VPN connection encrypts your internet traffic so your internet service provider or hackers can't intercept or see the internet traffic. Here is how you can install OpenVPN Access Server using Docker in just a few easy steps.

If you do not know what Docker is, be sure to read our What is Docker guide and comparison to VirtualBox in advance and get familiarized with the terms used. [Read: What is Usenet and why is it better than Torrents?]

Install OpenVPN Access Server using Docker

Before starting the Docker OpenVPN Access Server installation guide, make sure to follow our previous guides where you can learn to Install Docker on Ubuntu, Windows 10 Pro/Ent, and Windows 7 and 8.

Setup Openvpn Access Server In Docker
Docker Commandline Prompt

You can install OpenVPN Access Server using Docker in a new Docker container from scratch. But, ready-made containers are already available for several apps on Docker Hub. So all you need to do is pull those containers and install. If you are ready, open Docker command prompt and get ready to setup OpenVPN Access Server in Docker.

Surfshark VPN Exclusive Offer - 82% off ($2.39/month):
♦ Hide your browsing (no logs), Anonymize Streaming and Downloads
Wireguard Protocol support for VPN.
♦ Circumvent Geo/Country Restrictions and access worldwide content
♦ Works on Windows, Mac, Linux, Android, iOS, Router, and more
♦ 1 TB Encrypted Storage
♦ Money back guarantee - Sign Up Now

1. OpenVPN Access Server Pull Command

To install OpenVPN Access Server using Docker, you will first need to grab the latest version of OpenVPN Access Server container from the linuxserver Docker Hub. LinuxServer is a Docker repository with several HTPC and home server app containers.

docker pull linuxserver/openvpn-as

Pull the ready-made OpenVPN Access Server docker container using the above command.

2. Set OpenVPN Access Server Configuration Parameters in Docker

After pulling the container with the latest version of OpenVPN Access Server, we need to configure the usage parameters such as download folders, port number, etc. for the service. Copy all lines in the code block below (it is one single command) and paste it into docker prompt.

sudo docker create --name=openvpn-as \
--restart=always \
-v /home/docker/openvpn-as/config:/config \
-e INTERFACE=eth0 \
-e PGID=1001 -e PUID=1001 \
-e TZ=Europe/London \
--net=host --privileged \
linuxserver/openvpn-as

While you can just copy and paste the settings mentioned above, I recommend that you understand each parameter using the description below and customize it to your liking, in order to setup OpenVPN Access Server in Docker. Therefore, before issuing the above docker command, change certain parameters (eg. port number, folders, etc.) to fit your situation.

  • sudo docker create --name=openvpn-as \ - Creates a new docker container with the name "openvpn-as"
  • --restart=always \ - Starts the OpenVPN Access Server container automatically during boot.  If you don't want the container to be started automatically, you can skip this command.
  • -v /home/docker/openvpn-as/config:/config \ - Specifies the location of the OpenVPN Access Server config files. In this case, the config folder is located in /home/docker/openvpn-as/ directory.
  • -e PGID=1001 -e PUID=1001 \ - Specifies the user id in order to minimize permission issues that can arise between the host OS (Ubuntu) and the container.
  • -e TZ=Europe/London \ - Specifies the timezone information. You can check your timezone by following this link.
  • --net=host --privileged \ \ - Specifies the way OpenVPN Access Server runs in Docker. In this case, it runs in host mode and privileged mode. Please note that privileged mode is a must.

3. Start and Stop OpenVPN Access Server Container in Docker

If you used the correct parameters, you can go ahead and start the OpenVPN Access Server container you have just created, using the following command.

sudo docker start openvpn-as

After starting the OpenVPN Access Server Docker container, you will be able to open the web interface on port 5060. In my case the ip is https://192.168.0.108:943/admin/.

Openvpn Access Server Homepage
Openvpn Access Server Homepage

4. Change default credentials

The default credentials are admin/password. While you can skip this step, is recommended to modify the default credentials and add your own. In order to do this, run the following command:

Install Openvpn Access Server Using Docker
Openvpn Access Server Login Screen

docker exec -it openvpn-as passwd admin

Please note that you will need to run this command every time you update or reinstall this Docker container.

 

OpenVPN Access Server is now installed in Docker. What to do next?

Congratulations! You managed to install OpenVPN Access Server using Docker successfully. Once Docker is setup, it is extremely simple to create and destroy containers with apps. If you want to be able to access the OpenVPN Access Server outside your home network, be sure to setup port forwarding on your router. You will have to forward the OpenVPN Access Server ports to the local/internal IP address of the system with Docker installation. In a future guide, I will show you how you can fully configure OpenVPN Access Server and OpenVPN client so stay tuned!

In the meantime you can learn how to install the OpenVPN client on Windows and configure OpenVPN in order to connect to a VPN like SurfShark and enjoy a secure internetCheck back soon to learn more about Docker and how you can install various other services in Docker containers.

 

Be the 1 in 200,000. Help us sustain what we do.
31 / 150 by Dec 31, 2024
Join Us (starting from just $1.67/month)

Ciprian

Ciprian is an enthusiast, always up to date with the latest and greatest in the IT field. Passionate about computers, mobile devices and gadgets. In his spare time, he is a gamer.