blog.broncotoxique.com

Juste another geek’s website

TrueNAS Scale :: Docker Compose => qBittorrent + Gluetun

Based on the post from Raveen.ca here is a way to deploy a qBittorent with all the traffic going through a VPN using Gluetun. The most part of this post will be a copy of Raveen post.

My motivation and the main diffrence between Raveen and me is : I prefere using the official qBittorrent Docker package instead of using the qBittorrent packaged by LinuxServer.

So, let’s go !
The aim is, deploying an instance of qBittorrent with all the outgoing traffic passing-through a VPN tunnel.

Here you’ll find a compose.yml to deploy QBT : https://github.com/qbittorrent/docker-qbittorrent-nox
Here you’ll find the compose.yml to deploy GlueTun : https://github.com/qdm12/gluetun

  • If you’d like to deploy GlueTun on it’s own, an make sure that the QBT traffic goes through it, you’ll have to add --network=conntainer:gluetun to your QBT Docker deployment.
  • If you prefere deploying a docker-compose containing GlueTun and QBT you’ll have to add network_mode: "container:gluetun" inside the QBT deployment section.

About the how to deploy a docker compose on TrueNAS Scale, you can use your favorite solution, or follow the TrueNAS Scale documentation : https://www.truenas.com/docs/scale/scaleuireference/apps/installcustomappscreens/#add-custom-app-screen.

Prerequisites:

  • A working TrueNAS Scale, the last release might be better.
  • A VPN provider, and obviously all the parameters to configure a connection.

Instructions

Check that you have all the datasets you want, plus one dataset for QBT conf, and one for GlueTun conf if you need one, depending ont the type of tunnel you want to setup.

Here is the docker-compose.yaml you can use to run :

version: "3"
services:
  gluetun:
    image: qmcgaw/gluetun
    container_name: gluetun
    cap_add:
      - NET_ADMIN
    ports:
      - ${QBT_WEBUI_PORT}:${QBT_WEBUI_PORT}/tcp # 8080 By default. Mapping of the port to access QBT web IHM
    devices:
      - /dev/net/tun:/dev/net/tun
    environment:
      # Look into the Gluetun repo to define the configuration you need to use. Depending on your choice you may have to map a volume.
      - VPN_SERVICE_PROVIDER=...
      - VPN_TYPE=[openvpn, wireguard, ...]
      - OPENVPN_USER=...
      - OPENVPN_PASSWORD=...
      - PUID=568
      - PGID=568
      - TZ=[your-timezone] # get your TimeZone from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
      - [Any other option that seems usefull yor you]
    volumes: # If needed
      - ${GT_CONFIG_PATH}:/gluetun
  qbittorrent:
    image: qbittorrentofficial/qbittorrent-nox:latest
    container_name: qbittorrent-nox
    environment:
      - PUID=568 # TrueNAS Ddfault UID for Docker
      - PGID=568 # TrueNAS default GID for Docker
      - TZ=[your-timezone] # get your TimeZone from https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
      - QBT_LEGAL_NOTICE=confirm
      - QBT_VERSION=latest # Or the version you choosed
      - QBT_TORRENTING_PORT=${QBT_TORRENTING_PORT} # 6881 By default or the one you prefer
      - QBT_WEBUI_PORT=${QBT_WEBUI_PORT} # 8080 By default or the one you prefer, make sure to use the same port on GlueTun conf
    network_mode: service:gluetun
    depends_on:
      gluetun:
        condition: service_healthy
    ports: # This block is probably useless
      # for bittorrent traffic
      - ${QBT_TORRENTING_PORT}:${QBT_TORRENTING_PORT}/tcp
      - ${QBT_TORRENTING_PORT}:${QBT_TORRENTING_PORT}/udp
      # for WebUI
      - ${QBT_WEBUI_PORT}:${QBT_WEBUI_PORT}/tcp
    read_only: true
    stop_grace_period: 30m
    tmpfs:
      - /tmp
    tty: true
    volumes:
      - ${QBT_CONFIG_PATH}:/config
      - ${QBT_DOWNLOADS_PATH}:/downloads
    restart: unless-stopped
networks: {}

Inspiration Source : https://www.raveen.ca/posts/2025-05-29-qbit-gluetun/


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *