Last active
May 10, 2026 18:51
-
-
Save ahmedalhulaibi/bba293a423fae5466313a4d7741eef7d to your computer and use it in GitHub Desktop.
minimal qbittorrent+vpn networking docker-compose file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================================= | |
| # MINIMAL SETUP: qBittorrent routed through VPN via Gluetun | |
| # ============================================================================= | |
| # | |
| # HOW TO USE: | |
| # 1. Fill in the VPN credentials below (see NordVPN setup instructions in comments) | |
| # 2. Fill in your volume paths (see volume section comments) | |
| # 3. Run: docker compose up -d where ever the file is saved | |
| # 4. Access qBittorrent web UI at: http://localhost:8080 | |
| # Default credentials: admin / adminadmin (change these after first login!) | |
| # ============================================================================= | |
| services: | |
| # --------------------------------------------------------------------------- | |
| # GLUETUN — VPN client container | |
| # --------------------------------------------------------------------------- | |
| # All of qBittorrent's traffic will be routed through this container. | |
| # Ports for qBittorrent are published HERE (on gluetun), not on qbittorrent, | |
| # because qbittorrent shares gluetun's network namespace. | |
| # | |
| # NordVPN setup guide: | |
| # https://github.com/qdm12/gluetun-wiki/blob/main/setup/providers/nordvpn.md | |
| # --------------------------------------------------------------------------- | |
| gluetun: | |
| image: qmcgaw/gluetun:latest | |
| container_name: gluetun | |
| cap_add: | |
| - NET_ADMIN # Required — gluetun needs to manage network interfaces | |
| devices: | |
| - /dev/net/tun:/dev/net/tun # Required for VPN tunnel | |
| environment: | |
| - VPN_SERVICE_PROVIDER=nordvpn | |
| - VPN_TYPE=wireguard | |
| # --------------------------------------------------------------------------- | |
| # NordVPN WireGuard private key. | |
| # Retrieve it from: https://my.nordaccount.com/dashboard/nordvpn/ | |
| # Under "Manual Setup" > "WireGuard" > generate a key pair. | |
| # --------------------------------------------------------------------------- | |
| - WIREGUARD_PRIVATE_KEY=YOUR_NORDVPN_WIREGUARD_PRIVATE_KEY_HERE | |
| # --------------------------------------------------------------------------- | |
| # Optional: pin to a specific server or country. | |
| # Examples: | |
| # - SERVER_COUNTRIES=Canada | |
| # - SERVER_CITIES=Toronto | |
| # Leave blank to let gluetun pick automatically. | |
| # --------------------------------------------------------------------------- | |
| - SERVER_COUNTRIES= | |
| - TZ=America/Toronto # Change to your timezone if needed | |
| ports: | |
| # Expose qBittorrent web UI port — this is declared on the gluetun service but | |
| # you will access qBittorrent through http://localhost:8080 | |
| - 8080:8080 | |
| restart: unless-stopped | |
| # --------------------------------------------------------------------------- | |
| # QBITTORRENT — torrent client | |
| # --------------------------------------------------------------------------- | |
| # network_mode: service:gluetun means qBittorrent has NO network of its own — | |
| # all its traffic goes through the gluetun container. This is what routes | |
| # torrent traffic through the VPN. | |
| # | |
| # IMPORTANT: Because of this, ports must be published on gluetun (above), | |
| # not here. Any ports listed here would be ignored. | |
| # --------------------------------------------------------------------------- | |
| qbittorrent: | |
| image: ghcr.io/linuxserver/qbittorrent:latest | |
| container_name: qbittorrent | |
| network_mode: service:gluetun # <-- This is the key line. Routes all traffic through VPN. | |
| depends_on: | |
| - gluetun | |
| environment: | |
| - PUID=1000 # Your Windows user ID — leave as 1000 for Docker Desktop on Windows | |
| - PGID=1000 # Your Windows group ID — leave as 1000 for Docker Desktop on Windows | |
| - TZ=America/Toronto | |
| - WEBUI_PORT=8080 | |
| volumes: | |
| # --------------------------------------------------------------------------- | |
| # VOLUME MOUNTS — fill these in with your actual folder paths | |
| # | |
| # Format: - C:\path\on\your\pc:/path\inside\container | |
| # | |
| # CONFIG: Where qBittorrent stores its settings. Will be created if it | |
| # doesn't exist. Pick somewhere safe like: | |
| # C:\docker\qbittorrent\config:/config | |
| # | |
| # DOWNLOADS: Where torrents will be saved. Point this to your existing | |
| # downloads folder, e.g.: | |
| # D:\Downloads:/downloads | |
| # --------------------------------------------------------------------------- | |
| - C:\docker\qbittorrent\config:/config # CHANGE THIS | |
| - D:\Downloads:/downloads # CHANGE THIS | |
| restart: unless-stopped |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment