Skip to content

Instantly share code, notes, and snippets.

@samber
Created March 31, 2017 08:31
Show Gist options
  • Select an option

  • Save samber/ab90a799876d9c12120f0d681ce1665d to your computer and use it in GitHub Desktop.

Select an option

Save samber/ab90a799876d9c12120f0d681ce1665d to your computer and use it in GitHub Desktop.
Setup a VPN client on a linux host with Docker

DOCKERFILE:

FROM debian

ENV DEBIAN_FRONTEND="noninteractive"
INITRD="No"

ENV PACKAGES="openvpn"

RUN echo "*** Installing $PACKAGES" &&
apt-get update &&
apt-get install -yq --no-install-recommends $PACKAGES &&
apt-get clean &&
rm -rf /var/lib/apt/lists/*

VOLUME ["/vpn"]

ENTRYPOINT ["openvpn"]

RUN:

$ docker run -d --name openvpn --net=host --cap-add=NET_ADMIN --device /dev/net/tun:/dev/net/tun -v /root/:/vpn samber/openvpn-client --config /vpn/my-certificate.ovpn --auth-nocache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment