Sign inSign up

azinchen/nordvpn

By azinchen

•Updated 3 days ago

NordVPN Docker Client

Image
28

1M+

azinchen/nordvpn repository overview

logo

⁠NordVPN OpenVPN Docker Container

GitHub release GitHub release date GitHub build
GitHub stars GitHub forks Open issues GitHub last commit
Docker pulls Docker stars Docker image size
Multi-arch

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.

⁠✨ Key Features

  • 🚀 Easy Setup — Route any container's traffic through VPN with --net=container:vpn
  • 🌍 Smart Server Selection — Auto-select servers by country, city, group, or specific hostname (details⁠)
  • ⚖️ Load Balancing — Intelligent sorting by server load when multiple locations specified
  • 🔄 Auto-Reconnection — Periodic server switching and health monitoring (details⁠)
  • 🕵️ XOR Obfuscation — Built-in XOR patches disguise OpenVPN traffic to bypass DPI (details⁠)
  • 🛡️ Kill Switch — Default-deny firewall blocks all traffic when VPN is down (details⁠)
  • 🏠 Local/LAN Access — Allow specific CIDRs with NETWORK=... (details⁠)
  • 🧭 Custom DNS — Resolve through the tunnel; override with DNS=... (details⁠)
  • 📵 IPv6 Firewall — Built-in chains default to DROP (details⁠)
  • 🧱 iptables Compatibility — Auto-selects nft or legacy backend (details⁠)
  • 🚪 VPN Gateway Mode — Route downstream subnets through the tunnel with FORWARD_FROM (details⁠)

📖 Full documentation on the Wiki⁠ — configuration guides, examples, troubleshooting, FAQ, and architecture.


⁠Quick Start

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

⁠Requirements
  • Docker with --cap-add=NET_ADMIN and --device /dev/net/tun
  • NordVPN service credentials or an access token (not regular account credentials)
⁠Getting Service Credentials
  1. Log into your Nord Account Dashboard⁠
  2. Click on NordVPN → Advanced Settings → Set up NordVPN manually
  3. Go to the Service credentials tab
  4. Copy the Username and Password shown there

Note: These are different from your regular NordVPN login credentials.

Alternative — access token: instead of copying the service credentials, generate an access token (Nord Account Dashboard → NordVPN → Advanced Settings → Generate new token) and pass it as TOKEN; the container then fetches the service credentials from the NordVPN API at startup. If USER/PASS are also set, they take priority over the token.

⁠Docker Compose Example

services:
  vpn:
    image: azinchen/nordvpn:latest
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun
    environment:
      - USER=service_username
      - PASS=service_password
      # - TOKEN=access_token       # alternative to USER/PASS
      - COUNTRY=United States;CA
      - RANDOM_TOP=10
      - RECREATE_VPN_CRON=0 */6 * * *
      - NETWORK=192.168.1.0/24
    ports:
      - "8080:80"                  # host:container — use your app's listening port
    restart: unless-stopped

  app:
    image: nginx:alpine
    network_mode: "service:vpn"
    depends_on:
      - vpn
    restart: unless-stopped

More examples: Docker Compose⁠ · Docker Run⁠

⁠Environment Variables

List values (countries, cities, CIDRs, URLs, IPs) accept ; or , as separators; whitespace around separators is ignored.

⁠Credentials

NordVPN service credentials, set directly or fetched automatically with an access token — see Getting Service Credentials⁠ above.

VariableDetails
USERNordVPN service credentials username. Required unless TOKEN is set.
PASSNordVPN service credentials password. Required unless TOKEN is set.
TOKENNordVPN access token; the service credentials are fetched from the NordVPN API at startup. Ignored when USER/PASS are set.
⁠Server Selection

Pick which servers to connect to; filters combine to narrow the pool. See Server Selection⁠.

VariableDetails
COUNTRYFilter by countries: names, codes, IDs, or server hostnames (list⁠).
CITYFilter by cities: names, IDs, or server hostnames (list⁠).
GROUPFilter by server group (list⁠, details⁠).
RANDOM_TOPRandomize top N servers. Default: 0
⁠OpenVPN Connection

Protocol, port, and traffic obfuscation. See Technologies⁠.

VariableDetails
TECHNOLOGYOpenVPN protocol: name, identifier, or ID (list⁠). Default: openvpn_udp
PORTForce a specific port for the VPN connection. Must be supported by the server. Default: auto
DNSDNS servers written to resolv.conf; resolution goes through the tunnel (details⁠). off leaves resolv.conf untouched. Default: server‑pushed resolvers
XOR_KEYXOR scramble obfuscation key for openvpn_xor_* technologies (details⁠). Default: NordVPN's built-in key
OPENVPN_OPTSAdditional OpenVPN parameters (details⁠).
⁠Reconnection & Health Monitoring

Rotate servers on a schedule and verify the tunnel actually works. See Automatic Reconnection⁠.

VariableDetails
RECREATE_VPN_CRONServer switching schedule (cron). Default: disabled
CHECK_CONNECTION_CRONHealth monitoring schedule (cron). Default: disabled
CHECK_CONNECTION_URLURLs to test connectivity. Default: https://www.google.com
CHECK_CONNECTION_ATTEMPTSConnection test retry count. Default: 5
CHECK_CONNECTION_ATTEMPT_INTERVALSeconds between retries. Default: 10
HEALTHCHECK_ENABLEDEnable the Docker HEALTHCHECK probe (checks tun0 + connectivity via CHECK_CONNECTION_URL). When false, the container always reports healthy. Default: false
⁠Local Network & VPN Gateway

Open the kill‑switch firewall for LAN access and downstream routing. See Local Network Access⁠ and VPN Gateway Mode⁠.

VariableDetails
NETWORKLAN/inter‑container CIDRs to allow. Default: none
FORWARD_FROMDownstream CIDRs allowed to route OUT through the tunnel (gateway mode). Traffic must arrive already SNATed into these nets. Default: none
GATEWAY_DNSDNS interception for FORWARD_FROM clients: redirect (DNAT port 53 to the tunnel resolvers — server‑pushed, or DNS when set), local (DNAT port 53 to this container, for a co‑located resolver such as AdGuard Home), forward (DNAT port 53 to GATEWAY_DNS_SERVER, reached directly over the uplink — not through the tunnel), off. Default: off
GATEWAY_DNS_SERVERExternal IPv4 resolver(s) for GATEWAY_DNS=forward (e.g. an AdGuard Home on your LAN). With a list, the first resolver answering a DNS probe at startup is used. Default: none
TTL_SETRewrite the TTL of traffic leaving through the tunnel (e.g. 64); normalizes the value the VPN exit sees and hides every hop behind this container from client traceroutes (details⁠). Integer 1–255. Default: unset
TTL_INCIncrement the TTL of traffic arriving on eth0 (e.g. 1), cancelling this container's own decrement so it disappears from client traceroutes (details⁠). Needs FORWARD_FROM. Integer 1–255. Default: unset
⁠Advanced

Low‑level settings; the defaults work for most setups.

VariableDetails
NORDVPNAPI_IPIPs used for all NordVPN API access (no DNS involved). Default: 104.16.208.203;104.19.159.190
NETWORK_DIAGNOSTIC_ENABLEDEnable network diagnostics on connect (details⁠). Default: false

⁠Issues

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.

Tag summary

Content type

Image

Digest

sha256:e4d91d91a…

Size

15 MB

Last updated

3 days ago

docker pull azinchen/nordvpn