Run OpenVPN Server within Docker Container
Go to file
DrMaxNix ba554734a2
All checks were successful
Release / Build and publish Docker images (push) Successful in 1m19s
Release / Create Gitea release (push) Successful in 6s
👷 multi-platform build
2024-08-27 19:48:54 +02:00
.gitea/workflows 👷 multi-platform build 2024-08-27 19:48:54 +02:00
.editorconfig 👷 release ci 2024-08-24 21:20:30 +02:00
clientmgmt 🎉 initial codebase 2024-08-24 21:05:07 +02:00
Dockerfile 🎉 initial codebase 2024-08-24 21:05:07 +02:00
entrypoint.sh 🐛 fix keepalive ratio 2024-08-24 22:08:57 +02:00
LICENSE 📄 add license 2024-08-24 20:56:08 +02:00
README.md 📝 improve data volume path note 2024-08-24 22:59:22 +02:00

OpenVPN Docker

Run OpenVPN Server within Docker Container

Setup Instructions

Docker Run (not recommended):

$ docker run -d --name "openvpn" --cap-add=NET_ADMIN -v ./data:/etc/openvpn-data -p 1194:1194/tcp -p 1194:1194/udp drmaxnix/openvpn

Docker Compose (recommended):

services:
  main:
    image: drmaxnix/openvpn
    restart: unless-stopped
    volumes:
      - ./data:/etc/openvpn-data
    ports:
      - "1194:1194/udp"
      - "1194:1194/tcp"
    cap_add:
      - NET_ADMIN
$ docker compose up -d

▶️For both variants, persistent config and key files will be stored in the ./data directory. Feel free to change this to your needs.

Client Management

Generate new client keys and output its config:

$ docker compose exec main clientmgmt add

List registered client keys:

$ docker compose exec main clientmgmt list

Revoke a client's keys:

$ docker compose exec main clientmgmt revoke

▶️If you are using docker run, replace docker compose exec main with docker exec -it openvpn.