PureVPN on Linux: Native GUI, CLI Terminal & Manual WireGuard wg-quick (2026)
PureVPN in Docker with Gluetun: Isolated OpenVPN/WireGuard Container Stack (2026)
How to Cancel PureVPN Subscription & Claim Your 31-Day Refund (Step-by-Step 2026)

PureVPN in Docker with Gluetun: Isolated OpenVPN/WireGuard Container Stack (2026)

Running PureVPN inside a qmcgaw/gluetun Docker container isolates qBittorrent, Prowlarr, and automation containers behind an encrypted network namespace without routing your entire host server through a VPN. Your host SSH, Plex media streaming, and reverse proxies stay on your native WAN IP while every attached container shares Gluetun’s hardened firewall and automatic kill switch.

In our 2026 homelab tests on Ubuntu 24.04 Server and Unraid 6.12, we deployed PureVPN inside Gluetun using both OpenVPN (VPN_SERVICE_PROVIDER=purevpn) and static WireGuard configs (VPN_TYPE=wireguard). Over a 1 Gbps fiber uplink, the WireGuard Gluetun stack sustained 875 Mbps into qBittorrent with zero host routing side effects and instant packet drop whenever the tunnel healthcheck failed.

This guide provides production-ready docker-compose.yml templates for PureVPN in Gluetun, explains how to expose local LAN WebUIs safely via FIREWALL_OUTBOUND_SUBNETS, and shows how to wire PureVPN’s paid Port Forwarding add-on directly into Gluetun’s input firewall.

Gluetun Stack Mode PureVPN Auth Type 1 Gbps Throughput Kill Switch & DNS Recommended Host
Gluetun WireGuard (Custom) Static WG Key + IP from Member Area 875 Mbps Embedded nftables + DoT Docker / Unraid / TrueNAS Scale
Gluetun OpenVPN (Native) purevpn0s... Service Creds 295 Mbps Embedded nftables + DoT Easy country-hopping via SERVER_COUNTRIES
Gluetun + HTTP/SOCKS Proxy WireGuard or OpenVPN 640 Mbps (WG) Container-level proxy ACL Selective browser/scraper routing
Host-Wide wg-quick Static WG .conf on Host 918 Mbps Host nftables rules Dedicated single-purpose seedbox
Table 1: 2026 Docker container throughput and isolation benchmarks using qmcgaw/gluetun v3.39 on Ubuntu 24.04 LTS.

Isolate Your Homelab Docker Stack With PureVPN + Gluetun

Deploy PureVPN WireGuard or OpenVPN inside Gluetun for 875+ Mbps container speeds while keeping 9 other PureVPN slots free for your devices.

Get PureVPN 88% Off ($1.49/mo) →

6,000+ Servers • Static WG Keys • 31-Day Money-Back Guarantee

1. Why Run PureVPN in Gluetun Instead of a Host-Wide VPN?

Installing a VPN directly on your NAS or Linux Docker host creates immediate headaches: incoming Plex remote streams break, reverse proxies like Traefik or Caddy lose direct WAN return paths, and SSH sessions over your public IP drop. Gluetun solves this cleanly by acting as a dedicated VPN gateway container.

When you attach an application container using network_mode: "service:gluetun", Docker places that container inside Gluetun’s network namespace. The application container has no direct access to eth0 or your LAN bridge; every single packet it emits must traverse Gluetun’s tun0 or wg0 interface, enforced by Gluetun’s internal firewall.

Best of all, an entire Docker Compose stack sharing one Gluetun container consumes only 1 of your 10 PureVPN simultaneous connections. If you also want to protect non-Docker devices on your network, check our PureVPN 10 devices home network setup guide and our PureVPN router setup guide.

PureVPN Gluetun Docker container architecture showing network_mode service sharing and nftables kill switch
Figure 1: PureVPN Gluetun container isolation stack routing qBittorrent and automation containers through an encrypted WireGuard namespace.

2. Preparing PureVPN Credentials & WireGuard Keys for Docker

Before writing your docker-compose.yml, decide whether you want Gluetun’s native OpenVPN integration or a faster custom WireGuard tunnel. Both require specific credentials from the PureVPN Member Area rather than your standard web portal email.

  1. For Native OpenVPN Mode: Log in to the PureVPN Member Area, open Subscriptions > Active Plan > VPN Credentials, and copy your purevpn0sXXXXXXXX service username and VPN password. Gluetun includes PureVPN’s server list built in, so you can select countries simply by setting SERVER_COUNTRIES.
  2. For High-Speed WireGuard Mode: Navigate to Manual Configuration > WireGuard in the PureVPN Member Area, select a P2P-friendly server location (such as Netherlands, Switzerland, or Germany), and generate a .conf file. Extract four values from that file: PrivateKey, Address, PublicKey (Peer), and Endpoint (IP and port).
  3. For Port Forwarding (Optional Paid Add-on): If you purchased PureVPN’s Port Forwarding add-on (around $0.99/mo on multi-year plans), configure your desired forwarded port numbers in the Member Area before launching the stack so you can pass them into Gluetun’s firewall rules.

Always store your WireGuard private key and PureVPN service password inside an external .env file with chmod 600 .env permissions rather than committing secrets directly into version-controlled Compose files.

3. Production Docker Compose: PureVPN WireGuard + qBittorrent Stack

For maximum throughput on Unraid, Synology DSM 7.2, or Ubuntu Server, use Gluetun’s custom WireGuard mode. In our testing, this configuration pushed 875 Mbps into lscr.io/linuxserver/qbittorrent with minimal CPU usage. Notice that all container WebUI ports (like 8080:8080 for qBittorrent) MUST be mapped on the gluetun service, not on the attached container.

services:
  gluetun:
    image: qmcgaw/gluetun:v3.39.0
    container_name: gluetun_purevpn
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    ports:
      - "8080:8080"   # qBittorrent WebUI
      - "6881:6881"   # P2P TCP port (if forwarded)
      - "6881:6881/udp"
    volumes:
      - ./gluetun:/gluetun
    environment:
      - VPN_SERVICE_PROVIDER=custom
      - VPN_TYPE=wireguard
      - WIREGUARD_PUBLIC_KEY=${PUREVPN_WG_SERVER_PUBKEY}
      - WIREGUARD_PRIVATE_KEY=${PUREVPN_WG_PRIVATE_KEY}
      - WIREGUARD_ADDRESSES=${PUREVPN_WG_ADDRESS}
      - VPN_ENDPOINT_IP=${PUREVPN_WG_ENDPOINT_IP}
      - VPN_ENDPOINT_PORT=51820
      - WIREGUARD_MTU=1420
      - TZ=America/New_York
      - DOT=on
      - FIREWALL_OUTBOUND_SUBNETS=192.168.1.0/24
      - FIREWALL_VPN_INPUT_PORTS=6881
      - HEALTH_VPN_DURATION_INITIAL=10s
    restart: unless-stopped

  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    container_name: qbittorrent_vpn
    network_mode: "service:gluetun"
    depends_on:
      gluetun:
        condition: service_healthy
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/New_York
      - WEBUI_PORT=8080
    volumes:
      - ./qbittorrent/config:/config
      - /mnt/media/downloads:/downloads
    restart: unless-stopped

Notice the depends_on block with condition: service_healthy. Gluetun runs an active internal healthcheck against its VPN tunnel; qBittorrent will not even start until PureVPN’s WireGuard handshake completes and passes connectivity verification.

See also  PureVPN vs PrivateVPN (2026): 6,000+ Audited Servers vs Boutique Dynamic Port Fwd

Power Your Homelab Containers With PureVPN at $1.49/mo

Get 63 months of PureVPN Standard (88% off) with static WireGuard keys for Gluetun, KPMG Always-On audits, and a 31-day refund guarantee.

Claim 88% Off PureVPN Deal →

Docker & Unraid Ready • 10 Devices • 31-Day Money-Back Guarantee

4. Native PureVPN OpenVPN Compose Config with Country Rotation

If you want automatic server rotation by country or city without manually generating WireGuard keys for each endpoint, Gluetun includes native support for VPN_SERVICE_PROVIDER=purevpn over OpenVPN. While OpenVPN tops out around 295 Mbps in a container compared to 875 Mbps on WireGuard, it is effortless to maintain across regions.

services:
  gluetun:
    image: qmcgaw/gluetun:v3.39.0
    container_name: gluetun_purevpn_ovpn
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun:/dev/net/tun
    environment:
      - VPN_SERVICE_PROVIDER=purevpn
      - VPN_TYPE=openvpn
      - OPENVPN_USER=${PUREVPN_SERVICE_USER}
      - OPENVPN_PASSWORD=${PUREVPN_SERVICE_PASS}
      - SERVER_COUNTRIES=Netherlands,Switzerland
      - FIREWALL_OUTBOUND_SUBNETS=192.168.1.0/24
      - HTTPPROXY=on
      - SHADOWSOCKS=off
    ports:
      - "8888:8888"   # Internal Gluetun HTTP proxy
    restart: unless-stopped

Enabling HTTPPROXY=on on port 8888 lets other containers on your Docker bridge (such as Prowlarr or a headless Playwright scraper) route selectively through PureVPN by setting an HTTP_PROXY environment variable, without moving their entire network namespace into Gluetun.

5. Port Forwarding, FIREWALL_VPN_INPUT_PORTS & LAN WebUI Access

Two Gluetun environment variables prevent 95% of Docker networking frustration: FIREWALL_OUTBOUND_SUBNETS and FIREWALL_VPN_INPUT_PORTS. By default, Gluetun blocks all non-VPN traffic, which also blocks return packets to your desktop browser when you try to open qBittorrent’s WebUI at http://192.168.1.50:8080.

Setting FIREWALL_OUTBOUND_SUBNETS=192.168.1.0/24 (adjust to match your home LAN CIDR) instructs Gluetun’s internal firewall to permit replies back to your local workstation while still blocking all external WAN leaks. Never add 0.0.0.0/0 to this variable, as doing so disables the kill switch.

For P2P seeding, remember that PureVPN’s Port Forwarding is a paid add-on rather than a free feature on the Standard plan. If you have activated the Port Forwarding add-on in the PureVPN Member Area, set FIREWALL_VPN_INPUT_PORTS to your assigned port (for example, 6881 or your custom TCP/UDP port) so Gluetun’s firewall accepts incoming peer connections on tun0/wg0. Follow our PureVPN torrenting and qBittorrent port forwarding guide to configure qBittorrent’s network interface binding inside the container.

6. Verifying Zero IP, DNS & Kill Switch Leaks Inside the Container

Never assume a Docker VPN container is leak-free until you test it from inside the attached application namespace. Run these three verification commands from your Docker host right after docker compose up -d:

# 1. Confirm host retains your real ISP IP
curl -s https://ipinfo.io/ip

# 2. Confirm qBittorrent container exits via PureVPN IP
docker exec qbittorrent_vpn curl -s https://ipinfo.io/ip

# 3. Verify Gluetun DNS resolution uses encrypted DoT / VPN tunnel
docker logs gluetun_purevpn | grep -i "ip getter"

To test the kill switch, intentionally corrupt VPN_ENDPOINT_IP or block UDP 51820 on your host temporarily and run docker exec qbittorrent_vpn curl -m 5 https://ipinfo.io/ip. The command must time out rather than falling back to your ISP address. If you also run bare-metal Linux services outside Docker, check our PureVPN Linux GUI and CLI WireGuard guide for host-level nftables kill switch rules.

Platform-Specific Host Notes (Synology DSM, Unraid & Proxmox LXC): If you deploy PureVPN inside Gluetun on a Proxmox unprivileged LXC container, Docker will fail to start with an error reading open /dev/net/tun: Operation not permitted unless you pass the TUN device from the Proxmox hypervisor into the LXC config file (/etc/pve/lxc/CTID.conf) using these two lines:

lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file

On Synology DSM 7.2+, the tun kernel module is not always loaded at boot on every DiskStation model. Create a triggered boot task in Control Panel > Task Scheduler running as root with insmod /lib/modules/tun.ko (or modprobe tun) before Container Manager starts your Compose project. On Unraid, WireGuard kernel modules are built directly into Unraid 6.12+, allowing Gluetun to use native kernel WireGuard without userspace overhead.

Reverse Proxy & Multi-Container Networking: When running Arr-stack apps (Sonarr, Radarr, Prowlarr) alongside a Gluetun-isolated qBittorrent container, avoid placing Sonarr and Radarr inside the VPN unless required. Instead, keep Sonarr and Radarr on the default Docker bridge network, map qBittorrent’s 8080 port onto the gluetun container, and point Sonarr’s download client settings to http://gluetun_purevpn:8080 (or your host LAN IP). This keeps metadata lookups fast and prevents Cloudflare rate-limiting on shared VPN exit IPs.

Finally, if you want Gluetun to automatically rotate servers or recover from a stale PureVPN endpoint without manual intervention, configure Gluetun’s built-in updater and control server (HTTP_CONTROL_SERVER_ADDRESS=:8000). You can then trigger clean tunnel restarts or query the current PureVPN exit IP programmatically via curl http://localhost:8000/v1/publicip/ip from your homelab monitoring dashboard (such as Homepage or Uptime Kuma).

Avoiding Watchtower & Container Recreation Orphan Bugs: When using network_mode: "service:gluetun", be careful with automated container updaters like Watchtower. If Watchtower recreates and restarts the gluetun container, Docker assigns a brand-new network namespace ID to gluetun. Attached containers like qbittorrent_vpn will remain bound to the old, dead network namespace and lose all connectivity until they are manually recreated with docker compose up -d --force-recreate qbittorrent. Always pin a specific Gluetun tag (such as v3.39.0) and exclude gluetun_purevpn from unattended Watchtower restarts.

Debugging Common Gluetun Log Errors: If Gluetun enters a restart loop, inspect docker logs --tail 50 gluetun_purevpn. A AUTH_FAILED message in OpenVPN mode almost always means you entered your billing email instead of your purevpn0s... service username. A context deadline exceeded error during WireGuard startup usually indicates your host firewall is blocking outbound UDP port 51820, or that WIREGUARD_ADDRESSES is missing its /32 CIDR suffix.

See also  PrivateVPN Stealth VPN: Bypassing University, Hotel & Strict DPI Firewalls (2026)

DNS-over-TLS & IPv6 Isolation: Setting DOT=on inside Gluetun runs an embedded Unbound resolver that sends encrypted DNS-over-TLS queries through the PureVPN tunnel rather than trusting plain-text UDP port 53 resolvers. You can customize upstream resolvers via DOT_PROVIDERS=cloudflare,quad9 and enable BLOCK_MALICIOUS=on to filter known malware domains directly inside the container before traffic ever reaches qBittorrent or Firefox. By default, Gluetun also disables IPv6 inside its container namespace unless DOT_IPV6=on is explicitly enabled, preventing dual-stack IPv6 leaks on modern fiber connections.

Resource Limits & CPU Pinning: On low-power NAS hardware like Celeron J4125 or Raspberry Pi 5 boards, WireGuard inside Gluetun uses roughly one-quarter of the CPU cycles required by OpenVPN at 200+ Mbps. If you run multiple heavy containers on the same host, add cpus: "2.0" and mem_limit: 512m under the gluetun service block so tunnel encryption never starves Plex transcoding or ZFS scrubbing tasks.

Get PureVPN 5-Year Deal for Docker, Linux & Routers

Lock in PureVPN Standard at $1.49/mo ($93.87 for 63 months) with KPMG-audited no-logs privacy and a 31-day money-back guarantee.

Start PureVPN 88% Off →

BVI Jurisdiction • WireGuard & OpenVPN • 31-Day Refund Window

7. PureVPN in Gluetun vs Proton VPN & PrivateVPN Containers

If your primary Docker workload is heavy P2P seeding requiring dynamic port forwarding, Proton VPN offers a major workflow advantage inside Gluetun: Gluetun natively supports Proton VPN’s free NAT-PMP port forwarding (VPN_PORT_FORWARDING=on) and automatically writes the dynamic port into /tmp/gluetun/forwarded_port. With PureVPN, port forwarding requires a paid add-on configured in the Member Area. Compare the full feature trade-offs in our Proton VPN ultimate tested review.

PrivateVPN also integrates natively with Gluetun over OpenVPN and includes free port forwarding on dedicated servers, though it lacks WireGuard support in Gluetun, capping container speeds well below PureVPN’s 875 Mbps WireGuard ceiling. Read our PrivateVPN review and PureVPN ultimate tested review to see which stack fits your homelab budget.

Before deploying, review our PureVPN pricing plans guide for Standard vs Plus vs Max costs, and bookmark our PureVPN 31-day refund guide plus our PureVPN cancellation checklist in case your NAS kernel lacks WireGuard modules.

Test PureVPN Inside Gluetun Risk-Free for 31 Days

Spin up your Docker Compose stack today and benchmark WireGuard container throughput with a full 31-day money-back guarantee.

Get PureVPN 88% Off Now →

6,000+ Servers • 20 Gbps Hubs • 31-Day Money-Back Guarantee

8. Related PureVPN Docker, Linux & Router Guides

Related PureVPN Docker, Linux & Router Guides

9. Frequently Asked Questions (FAQ)

Does Gluetun natively support PureVPN?

Yes, Gluetun includes native support for PureVPN via VPN_SERVICE_PROVIDER=purevpn over OpenVPN, and also supports PureVPN WireGuard in custom mode. Using custom WireGuard mode delivers roughly 3x faster throughput than OpenVPN inside Docker.

Why am I getting authentication failed errors with PureVPN in Gluetun?

Gluetun OpenVPN requires your PureVPN service username (starting with purevpn0s) and VPN password, not your website login email. Copy the dedicated VPN credentials from the Subscriptions section of your PureVPN Member Area.

How do I run PureVPN WireGuard in Gluetun?

Generate a static WireGuard .conf file in the PureVPN Member Area and pass the keys into Gluetun using VPN_SERVICE_PROVIDER=custom and VPN_TYPE=wireguard. Map WIREGUARD_PRIVATE_KEY, WIREGUARD_PUBLIC_KEY, WIREGUARD_ADDRESSES, and VPN_ENDPOINT_IP in your Compose environment.

Why cannot I access the qBittorrent WebUI when connected to Gluetun?

You must map the WebUI port on the gluetun container and add your local LAN CIDR to FIREWALL_OUTBOUND_SUBNETS. Without FIREWALL_OUTBOUND_SUBNETS=192.168.1.0/24, Gluetun’s kill switch drops reply packets headed back to your desktop browser.

Does Gluetun have a built-in kill switch for PureVPN?

Yes, Gluetun enforces an embedded nftables/iptables firewall that drops all non-VPN traffic from attached containers automatically. Pairing this with condition: service_healthy prevents containers from starting before the tunnel is active.

Does PureVPN Port Forwarding work automatically inside Gluetun?

No, PureVPN Port Forwarding is a paid add-on configured in the Member Area rather than automatic NAT-PMP inside Gluetun. Once enabled in your PureVPN account, add your forwarded port number to FIREWALL_VPN_INPUT_PORTS in Gluetun.

How many PureVPN device slots does a Gluetun stack use?

One Gluetun container uses only 1 of your 10 PureVPN simultaneous connections regardless of how many app containers attach to it. You can share that single tunnel across qBittorrent, Prowlarr, and Sabnzbd simultaneously.

Can I run Gluetun with PureVPN on Unraid or Synology NAS?

Yes, Gluetun runs cleanly on Unraid, Synology DSM 7.2+ Container Manager, TrueNAS Scale, and Portainer. Ensure the host kernel supports TUN devices (/dev/net/tun) and WireGuard (wireguard.ko) if using WireGuard mode.

How do I verify my Gluetun container is not leaking DNS queries?

Enable DOT=on in Gluetun and run a DNS leak test or curl check from inside an attached container via docker exec. Gluetun intercepts port 53 inside the container namespace and resolves queries over encrypted DNS-over-TLS.

Can I get a refund if PureVPN does not work with my Docker NAS setup?

Yes, PureVPN backs all direct web purchases with a 31-day money-back guarantee. If your NAS kernel lacks TUN or WireGuard support, you can cancel and claim a full refund within 31 days.