OpenVPN via Docker builds


Im trying to run openvpn within docker, but I’m seeing the following error trying to connect the tun device.

docker run -it --cap-add=NET_ADMIN --device /dev/net/tun --name vpn -d dperson/openvpn-client -v '$VPN_SERVER;$VPN_USER;$VPN_PASSWORD'
Unable to find image 'dperson/openvpn-client:latest' locally
latest: Pulling from dperson/openvpn-client

Digest: sha256:86a8216f54a8ef32f90d3bcd366ea106ac939cb9dd8e1d7430ec8dd8b17ec963
Status: Downloaded newer image for dperson/openvpn-client:latest
docker: Error response from daemon: error gathering device information while adding custom device "/dev/net/tun": lstat /dev/net/tun: no such file or directory.

docker run -it --cap-add=NET_ADMIN --device /dev/net/tun --name vpn -d dperson/openvpn-client -v '$VPN_SERVER;$VPN_USER;$VPN_PASSWORD' returned exit code 125

Action failed: docker run -it --cap-add=NET_ADMIN --device /dev/net/tun --name vpn -d dperson/openvpn-client -v '$VPN_SERVER;$VPN_USER;$VPN_PASSWORD'

VPNs are not possible, please see for details.

Per this post is a possible workaround though