OpenVPN in a Docker container

Run a docker container:

export MY_IP=<my server IP>

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

Determined its IP address:

sudo docker ps
sudo docker inspect dockovpn | grep IPAddress
            "SecondaryIPAddresses": null,
            "IPAddress": "172.17.0.3",
                    "IPAddress": "172.17.0.3",
wget -O client.ovpn http://172.17.0.3:8080
sudo ufw allow from <my client IP> to any port 1194 proto 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 91.122.37.167:62207 peer info: IV_VER=2.5.7
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_PLAT=win
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_PROTO=6
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_NCP=2
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_CIPHERS=AES-256-GCM:AES-128-GCM
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_LZ4=1
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_LZ4v2=1
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_LZO=1
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_COMP_STUB=1
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_COMP_STUBv2=1
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_TCPNL=1
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_GUI_VER=OpenVPN_GUI_11
2022-10-14 20:29:34 91.122.37.167:62207 peer info: IV_SSO=openurl,crtext
2022-10-14 20:29:34 91.122.37.167:62207 [VqsckXh6zb2YjxMjNhoBWTrSmjdTKqKw] Peer Connection Initiated with [AF_INET]91.122.37.167:62207
2022-10-14 20:29:34 VqsckXh6zb2YjxMjNhoBWTrSmjdTKqKw/<my client ip>:62207 MULTI_sva: pool returned IPv4=10.8.0.6, IPv6=(Not enabled)

Press Ctrl+P Ctrl+Q in docker terminal.

1 Response 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 https://github.com/angristan/openvpn-install

Leave a Reply

Your email address will not be published.