OpenVPN in a Docker container

Run a docker container:

export MY_IP=$(curl -s

sudo docker run -it --rm --cap-add=NET_ADMIN -p 1194:1194/udp -e HOST_ADDR=$MY_IP --name dockovpn alekslitvinenk/openvpn


sudo docker run -it --rm --cap-add=NET_ADMIN -p 1194:1194/udp -e HOST_ADDR=$MY_IP --name dockovpn alekslitvinenk/openvpn -v openvpn_conf:/opt/Dockovpn_data

to persist generated files in volume storage.

Type Ctrl+P then Ctrl+Q to turn interactive mode to daemon mode.

Determine its IP address:

sudo docker ps
sudo docker inspect dockovpn | grep IPAddress
            "SecondaryIPAddresses": null,
            "IPAddress": "",
                    "IPAddress": "",
wget -O client.ovpn
sudo ufw allow from <my client IP> to any port 1194 proto udp
sudo ufw allow 1194/udp

Install OpenVPN client on Windows machine, connect and measure the speed:

Docker output:

2022-10-14 20:26:51 Initialization Sequence Completed
Fri Oct 14 20:26:51 2022 /opt/Dockovpn_data/clients/VqsckXh6zb2YjxMjNhoBWTrSmjdTKqKw/client.ovpn file has been generated
Fri Oct 14 20:26:51 2022 Config server started, download your client.ovpn config at http://<my server IP>:80/
Fri Oct 14 20:26:51 2022 NOTE: After you download your client config, http server will be shut down!
Fri Oct 14 20:28:03 2022 Config http server has been shut down
2022-10-14 20:29:34 peer info: IV_VER=2.5.7
2022-10-14 20:29:34 peer info: IV_PLAT=win
2022-10-14 20:29:34 peer info: IV_PROTO=6
2022-10-14 20:29:34 peer info: IV_NCP=2
2022-10-14 20:29:34 peer info: IV_CIPHERS=AES-256-GCM:AES-128-GCM
2022-10-14 20:29:34 peer info: IV_LZ4=1
2022-10-14 20:29:34 peer info: IV_LZ4v2=1
2022-10-14 20:29:34 peer info: IV_LZO=1
2022-10-14 20:29:34 peer info: IV_COMP_STUB=1
2022-10-14 20:29:34 peer info: IV_COMP_STUBv2=1
2022-10-14 20:29:34 peer info: IV_TCPNL=1
2022-10-14 20:29:34 peer info: IV_GUI_VER=OpenVPN_GUI_11
2022-10-14 20:29:34 peer info: IV_SSO=openurl,crtext
2022-10-14 20:29:34 [VqsckXh6zb2YjxMjNhoBWTrSmjdTKqKw] Peer Connection Initiated with [AF_INET]
2022-10-14 20:29:34 VqsckXh6zb2YjxMjNhoBWTrSmjdTKqKw/<my client ip>:62207 MULTI_sva: pool returned IPv4=, IPv6=(Not enabled)

Press Ctrl+P Ctrl+Q in docker terminal.

MacOS client:

Removing firewall rules on the server:

sudo ufw delete allow 1194/udp
sudo ufw delete allow from <my client IP> to any port 1194 proto udp

7 Responses to OpenVPN in a Docker container

  1. dmitriano says:

    Password-protected clients are not supported by the headless installation method since user input is expected by Easy-RSA. see

  2. dmitriano says:

    Installing Docker:

    useradd -d /home/dmitriano -m --uid 1000 --shell "/bin/bash" dmitriano
    usermod -a -G sudo dmitriano
    passwd dmitriano
    su - dmitriano

  3. dmitriano says:

    Yes, you’d likely want to set up whatever desktop environment you intend to use first, then install VNC and get that configured. While KDE isn’t exactly a super resource intensive DE, I’d recommend checking out LXQT, LXDE or XFCE instead of KDE or Gnome, simply as it runs more performant on a virtualized environment.

  4. dmitriano says:

    Service – OpenVPN
    sudo apt install openvpn easy-rsa

  5. dmitriano says:


    ipconfig /flushdns

    from Windows Command Prompt helps with

    mtr: Failed to resolve host: Temporary failure in name resolution

    that periodically happens on Windows 10 with OpenVPN.

Leave a Reply

Your email address will not be published. Required fields are marked *