Minimal Docker OpenVPN Container

At 8.6mb perhaps the smallest openvpn docker container I could come up with.

Using apline linux as the base because, well its so damned small

The Dockerfile

FROM alpine:latest

MAINTAINER aussieade

RUN apk update && apk add openvpn

CMD ["/etc/openvpn/"]

The startup script


mkdir -p /dev/net
mknod /dev/net/tun c 10 200

IP=$(grep '^server .*$' /etc/openvpn/server.conf | awk '{print $2}')

iptables -t nat -A POSTROUTING -s ${IP}/24 -o eth0 -j MASQUERADE

/usr/sbin/openvpn --cd /etc/openvpn --config /etc/openvpn/server.conf --script-security 2

openvpn config files should live in /data/openvpn, assuming thats where you put them run the container with something like

docker run -d -t -i -p 1194:1194 -v /data/openvpn:/etc/openvpn --cap-add=NET_ADMIN aussieade/minivpn

Next is to see if I can make it even smaller by building it with buildroot

Update: yes I can, see Even Smaller VPN

Date: 2015-04-15 Wed

Emacs 24.5.1 (Org mode 8.2.10)