Add Gluetun VPN Support for Apps

Sorry, I no longer recommend this technique at all. After fighting a lot with the community apps, I no longer even recommend using any of them, except for Dockge.

What I finally ended up doing was:

  1. Installed Dockge from community apps.

  2. Installed Gluetun using standard docker-compose yml, from ghcr.io. This looks like:

services:
  gluetun:
    image: ghcr.io/qdm12/gluetun
    #image: qmcgaw/gluetun
    container_name: gluetun
    # See https://github.com/qdm12/gluetun-wiki/blob/main/setup/connect-a-container-to-gluetun.md#external-container-to-gluetun
    cap_add:
      - NET_ADMIN
    ports:
      - 8080:8080 #qbittorrent
      - 6881:6881 #qbittorrent
      - 6881:6881/udp #qbittorrent
    volumes:
      - /mnt/pool/apps/gluetun:/gluetun
    devices:
      - /dev/net/tun:/dev/net/tun
    environment:
      # See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup
      - TZ=<your TZ>
      - VPN_SERVICE_PROVIDER=<your VPN provider>
      - VPN_TYPE=wireguard
      - SERVER_COUNTRIES=<country/ies you want your traffic to exit through>
      - WIREGUARD_PRIVATE_KEY=<private key>
      - WIREGUARD_ADDRESSES=<address from VPN provider>
    restart: unless-stopped
networks: {}

  1. Installed Qbittorrent using standard docker-compose yml, from linuxserver.io. This looks like:
services:
  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    container_name: qbittorrent
    environment:
      - PUID=<user ID for qbittorrent>
      - PGID=<group ID for qbittorrent>
      - TZ=<your TZ>
      - WEBUI_PORT=8080
      - TORRENTING_PORT=6881
    volumes:
      - /mnt/pool/apps/qbittorrent:/config
      - /mnt/pool/apps/qbittorrent/downloads:/downloads
    restart: unless-stopped
    network_mode: container:gluetun
    # Note that all ports were moved to the gluetun app.
networks: {}

After that, everything should work, with traffic funneled through the VPN in the “gluetun” container.