OpenVPN client docker container that routes other containers' traffic through NordVPN servers automatically.
Prefer WireGuard? This has a sibling project, azinchen/nordvpn-wg — the same auto-routing NordVPN container over WireGuard (NordLynx). Both share the same configuration model and feature set.
--net=container:vpnNETWORK=... (details)FORWARD_FROM=... (details)📖 Full documentation on the Wiki — configuration guides, examples, troubleshooting, FAQ, and architecture.
docker run -d --cap-add=NET_ADMIN --device /dev/net/tun --name vpn \
-e USER=service_username -e PASS=service_password \
azinchen/nordvpn
Route other containers through VPN:
docker run --net=container:vpn -d your/application
Also available from GitHub Container Registry: ghcr.io/azinchen/nordvpn
--cap-add=NET_ADMIN and --device /dev/net/tunNote: These are different from your regular NordVPN login credentials.
services:
vpn:
image: azinchen/nordvpn:latest
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
environment:
- USER=service_username
- PASS=service_password
- COUNTRY=United States;CA
- RANDOM_TOP=10
- RECREATE_VPN_CRON=0 */6 * * *
- NETWORK=192.168.1.0/24
ports:
- "8080:8080"
restart: unless-stopped
app:
image: nginx:alpine
network_mode: "service:vpn"
depends_on:
- vpn
restart: unless-stopped
More examples: Docker Compose · Docker Run
| Variable | Details |
|---|---|
| USER | Required — NordVPN service credentials username. |
| PASS | Required — NordVPN service credentials password. |
| PUID | User ID for the nordvpn process. Default: 912 |
| PGID | Group ID for the nordvpn process. Default: 912 |
| COUNTRY | Filter by countries: names, codes, IDs, or server hostnames (list). Semicolon‑separated. |
| CITY | Filter by cities: names, IDs, or server hostnames (list). Semicolon‑separated. |
| GROUP | Filter by server group (list). |
| TECHNOLOGY | OpenVPN protocol (list). Default: openvpn_udp |
| RANDOM_TOP | Randomize top N servers. Default: 0 |
| PORT | Force a specific port for the VPN connection. Must be supported by the server. Default: auto |
| RECREATE_VPN_CRON | Server switching schedule (cron). Default: disabled |
| CHECK_CONNECTION_CRON | Health monitoring schedule (cron). Default: disabled |
| CHECK_CONNECTION_URL | URLs to test connectivity; semicolon‑separated. Default: https://www.google.com |
| CHECK_CONNECTION_ATTEMPTS | Connection test retry count. Default: 5 |
| CHECK_CONNECTION_ATTEMPT_INTERVAL | Seconds between retries. Default: 10 |
| NETWORK | LAN/inter‑container CIDRs to allow; semicolon‑separated. Default: none |
| FORWARD_FROM | Downstream CIDRs allowed to route OUT through the tunnel (gateway mode). Traffic must arrive already SNATed into these nets. Semicolon‑ or comma‑separated. Default: none |
| NORDVPNAPI_IP | API bootstrap IPs (semicolon‑separated). Default: 104.16.208.203;104.19.159.190 |
| XOR_KEY | XOR scramble obfuscation key for openvpn_xor_* technologies. Default: NordVPN's built-in key |
| OPENVPN_OPTS | Additional OpenVPN parameters. |
| NETWORK_DIAGNOSTIC_ENABLED | Enable network diagnostics on connect. Default: false |
| HEALTHCHECK_ENABLED | Enable the Docker HEALTHCHECK probe (checks tun0 + connectivity via CHECK_CONNECTION_URL). When false, the container always reports healthy. Default: false |
If you have any problems with or questions about this image, please contact me through a GitHub issue or email.
Check the Troubleshooting and FAQ wiki pages first.
Content type
Image
Digest
sha256:eab3411e1…
Size
14.9 MB
Last updated
11 days ago
docker pull azinchen/nordvpn