bubuntux / nordvpn

NordVpn Docker Client
GNU Affero General Public License v3.0
746 stars 197 forks source link
386 arm arm64 armv7 container docker docker-image linux nordlynx nordvpn openvpn vpn vpn-client wireguard x86-64


Official NordVPN client in a docker container; it makes routing traffic through the NordVPN network easy and secure with an integrated iptables kill switch.

How to use this image

This container was designed to be started first to provide a connection to other containers (using --net=container:vpn, see below Starting an NordVPN client instance).

NOTE: More than the basic privileges are needed for NordVPN. With Docker 1.2 or newer, Podman, Kubernetes, etc. you can use the --cap-add=NET_ADMIN,NET_RAW option. Earlier versions, or with fig, and you'll have to run it in privileged mode.

Starting an NordVPN instance

docker run -ti --cap-add=NET_ADMIN --cap-add=NET_RAW --name vpn \
           -e TOKEN=f6f2bb45... \
           -e TECHNOLOGY=NordLynx -d ghcr.io/bubuntux/nordvpn

Once it's up other containers can be started using its network connection:

docker run -it --net=container:vpn -d other/docker-container

docker-compose example

version: "3"
services:
  vpn:
    image: ghcr.io/bubuntux/nordvpn
    cap_add:
      - NET_ADMIN               # Required
      - NET_RAW                 # Required
    environment:                # Review https://github.com/bubuntux/nordvpn#environment-variables
      - TOKEN=f6f2bb45...     # Required
      - CONNECT=United_States
      - TECHNOLOGY=NordLynx
      - NETWORK=192.168.1.0/24  # So it can be accessed within the local network
    ports:
      - 8080:8080
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=1  # Recomended if using ipv4 only
  torrent:
    image: ghcr.io/linuxserver/qbittorrent
    network_mode: service:vpn
    depends_on:
      - vpn

# The torrent service would be available at http://localhost:8080/ 
# or anywhere inside of the local network http://192.168.1.xxx:8080

docker-compose example using reverse proxy

version: "3"
services:
  proxy:
    image: traefik:v2.4         # Review traefik documentation https://doc.traefik.io/traefik/ 
    container_name: traefik
    command:
      - --api.insecure=true
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
    ports:
      - 80:80
      - 8080:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped
  vpn:
    image: ghcr.io/bubuntux/nordvpn
    container_name: vpn
    cap_add:
      - NET_ADMIN               # Required
      - NET_RAW                 # Required
    environment:                # Review https://github.com/bubuntux/nordvpn#environment-variables
      - TOKEN=f6f2bb45...       # Required
      - CONNECT=United_States
      - TECHNOLOGY=NordLynx
    sysctls:
      - net.ipv6.conf.all.disable_ipv6=1  # Recomended if using ipv4 only
  torrent:
    image: ghcr.io/linuxserver/qbittorrent
    network_mode: container:vpn
    labels:
      - traefik.enable=true
      - traefik.http.services.torrent.loadbalancer.server.port=8080
      - traefik.http.routers.torrent.rule=Host(`custom-host`)
    depends_on:
      - vpn

# Make sure that custom-host resolves to the ip address of the server 
# for example /etc/hosts contains 127.0.0.1  custom-host
# the torrent service would be available at http://custom-host

docker-compose example using reverse proxy with TLS

version: "3"
services:
  proxy:
    image: traefik:v2.4             # Review traefik documentation https://doc.traefik.io/traefik/ 
    container_name: traefik
    command:
      - --api.insecure=true
      - --providers.docker=true
      - --providers.docker.exposedbydefault=false
      - --entrypoints.web.address=:80
      - --entrypoints.web.http.redirections.entrypoint.to=websecure
      - --entrypoints.websecure.address=:443
      - --entrypoints.websecure.http.tls.certresolver=letsencrypt
      - --certificatesresolvers.letsencrypt.acme.tlschallenge=true
      - --certificatesresolvers.letsencrypt.acme.email=my@email.com # Replace with your email
      - --certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    volumes:
      - ./letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped
  domain:
    image: ghcr.io/linuxserver/duckdns   # Review doc https://github.com/linuxserver/docker-duckdns
    container_name: duckdns
    environment:
      - TOKEN=ABCDFEG                    # Required
      - SUBDOMAINS=domain1,domain2       # Required
    restart: unless-stopped
  media:
    image: ghcr.io/linuxserver/plex
    container_name: plex
    labels:
      - traefik.enable=true
      - traefik.http.services.media.loadbalancer.server.port=32400
      - traefik.http.routers.media.rule=Host(`myplex.duckdns.org`)   # Replace with your domain
    devices:
      - /dev/dri:/dev/dri
    restart: unless-stopped
  vpn:
    image: ghcr.io/bubuntux/nordvpn
    container_name: nordvpn
    cap_add:
      - NET_ADMIN               # Required
      - NET_RAW                 # Required
    environment:                # Review https://github.com/bubuntux/nordvpn#environment-variables
      - TOKEN=f6f2bb45...       # Required
      - CONNECT=United_States
      - TECHNOLOGY=NordLynx
      - WHITELIST=showrss.info,rarbg.to,yts.mx
     sysctls:
      - net.ipv6.conf.all.disable_ipv6=1  # Recomended if using ipv4 only
  torrent:
    image: ghcr.io/linuxserver/qbittorrent
    container_name: qbittorrent
    network_mode: service:vpn
    depends_on:
      - vpn
    labels:
      - traefik.enable=true
      - traefik.http.services.torrent.loadbalancer.server.port=8080
      - traefik.http.routers.torrent.rule=Host(`mytorrent.duckdns.org`) # Replace with your domain
    restart: unless-stopped

# Make sure that you can access your server from the internet
# for example configure dmz on your router
# the torrent service would be available at https://mytorrent.duckdns.org

ENVIRONMENT VARIABLES

Issues

If you have any problems with or questions about this image, please contact me through a GitHub issue.

Disclaimer

This project is independently developed for personal use, there is no affiliation with NordVpn or Nord Security companies, Nord Security companies are not responsible for and have no control over the nature, content and availability of this project.