OpenVPN docker image with full IPv6 support

As I mentioned earlier, I’ve developed my own tool for managing OpenVPN servers. I’ve been running several instances without any issues, and last weekend, I finally decided to add full IPv6 support. This includes both connecting to the server via IPv6 and routing IPv6 traffic within the tunnel.

Initially, I spent several hours troubleshooting how to get an IPv6 setup working in Docker. Many documents claim that Docker is entirely incompatible with IPv6, while others suggest you can enable IPv6 but must manually manage networks, NAT, and other configurations. However, this isn’t entirely true.

Basic IPv6 support has been available in Docker for years (see ipv6 option), but you used to need to handle subnets and routing manually. Now, Docker can manage all the necessary iptables configurations, including SNAT/masquerading for IPv6, if you enable the experimental and ip6tables options.

A detailed guide on the docker setup can be found here.

As for OpenVPN, I’ve added IPv6 support to the gerasiov/openvpn image (with the recommended setup described in the README), so anyone can easily set up their own IPv6-capable OpenVPN server in just five minutes.

Docker OpenVPN image

For several years I was using kylemanna/openvpn as OpenVPN server. Unfortunately author does not update it anymore. It has old OpenVPN version, several problems (like renew command not working) and bad cli in common.

So one day I sit and rewrite it (on python, so image grew from 20MB to 55MB, I believe that not a problem).

GitHub page: https://github.com/gerasiov/docker-openvpn

Docker image: gerasiov/openvpn:latest (hub)

I have several more features to add:

  • Server certificate renewal
  • Configurable certificates expiration time
  • IPv6 support

But it’s already useful enough.