OPERATING SYSTEMSOS Linux

Running OpenVPN in Docker on Ubuntu

In this demo I show how you can run OpenVPN in a docker container on a Ubuntu host. Once the OpenVPN server has been created and is running in a docker container, I show how you can connect to the VPN server from a different Ubuntu instance.

The command list is available here: https://gitlab.com/d5955/openvpn-commands/-/tree/main

source

ubuntu

13 thoughts on “Running OpenVPN in Docker on Ubuntu

  • I prob take the deal and move across the world

  • Good video. Just wanted to find out if this OpenVpn has a GUI to manage users as well?

  • It work in 2022! Thanks for the content. Very usefull. You grant my inscription

  • If someone is lazy then here are the commands:

    OVPN_DATA="open_vpn"

    docker volume create –name $OVPN_DATA

    docker run –rm -v $OVPN_DATA:/etc/openvpn kylemanna/openvpn ovpn_genconfig -u udp://{ip}:1194

    -create cert

    docker run –rm -v $OVPN_DATA:/etc/openvpn -it kylemanna/openvpn ovpn_initpki

    -create client acc

    docker run –rm -v $OVPN_DATA:/etc/openvpn -it kylemanna/openvpn easyrsa build-client-full client

    -copy cl cert

    docker run –rm -v $OVPN_DATA:/etc/openvpn kylemanna/openvpn ovpn_getclient client > client.ovpn

    -start

    docker run –name open_vpn_server -v $OVPN_DATA:/etc/openvpn -d -p 1194:1194/udp –cap-add=NET_ADMIN –restart always kylemanna/openvpn

  • Hello!
    Thanks for the Vid! Im enjoying finally reaching all my web services without ssh port forwarding.
    I had to build the kylemanna container on my raspberry pi (libseccomp2 upgrade needed.. slow raspberry repos and alpine issue)
    It works fine, but I also have a samba share.
    The funny thing is, I can connect to it, i can even download, but cant upload.
    permissions on shared folder are 777.
    created a docker bridge network for openvpn container.
    edited smb.conf to allow interface from bridge network (I can connect through that 172.25.0….)
    Still cant upload any file.
    I think its a two-way connection since my other webapps work fine. so how can download work but not upload?
    Anyway, if its not an openvpn issue, dont mind me, but thanks for any answer! 🙂

  • docker run –rm -v openvpn:/etc/openvpn kylemanna/openvpn ovpn_getclient usr1 > client.ovpn

  • You could put the used commands in the description os something, other than that this has helped me a lot

Comments are closed.