Run OpenVPN Server within Docker Container
.gitea/workflows | ||
.editorconfig | ||
clientmgmt | ||
Dockerfile | ||
entrypoint.sh | ||
LICENSE | ||
README.md |
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
Tip
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
Note
If you are using docker run, replace
docker compose exec main
withdocker exec -it openvpn
.