# OpenVPN Docker Run OpenVPN Server within Docker Container ## Setup Instructions **Docker Run** (not recommended): ```console $ 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): ```yaml services: main: image: drmaxnix/openvpn restart: unless-stopped volumes: - ./data:/etc/openvpn-data ports: - "1194:1194/udp" - "1194:1194/tcp" cap_add: - NET_ADMIN ``` ```console $ 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: ```console $ docker compose exec main clientmgmt add ``` List registered client keys: ```console $ docker compose exec main clientmgmt list ``` Revoke a client's keys: ```console $ docker compose exec main clientmgmt revoke ``` > [!NOTE] > If you are using docker run, replace `docker compose exec main` with `docker exec -it openvpn`.