Thanks for the suggestions, @swc-phil, @usergiven, and @mistermanko. I was wanting to keep things as similar as possible to previously, because it’d been working without issue previously. The solution I’ve found was to bring the gluetun container into the qBittorrent stack, like this:
services:
qbittorrent:
image: lscr.io/linuxserver/qbittorrent:latest
container_name: qbittorrent
environment:
- PUID=568
- PGID=568
- TZ=America/New_York
- WEBUI_PORT=8080
- TORRENTING_PORT=6881
volumes:
- /mnt/software/docker/data/qbittorrent/config:/config
- /mnt/tank/torrents/qbittorrent:/mnt/torrents/qbittorrent
restart: unless-stopped
network_mode: service:gluetun
labels:
- com.centurylinklabs.watchtower.enable=true
gluetun:
image: qmcgaw/gluetun
container_name: gluetun
restart: unless-stopped
cap_add:
- NET_ADMIN
expose:
- 6881
- 6881/udp
devices:
- /dev/net/tun:/dev/net/tun
environment:
- VPN_SERVICE_PROVIDER=surfshark
- VPN_TYPE=wireguard
- WIREGUARD_PRIVATE_KEY=(REMOVED)
- WIREGUARD_ADDRESSES=(REMOVED)
- SERVER_HOSTNAMES=(REMOVED)
- TZ=America/New_York
networks:
- proxy
labels:
- caddy=qbt.domain
- caddy.reverse_proxy="{{upstreams 8080}}"
- homepage.group=Media
- homepage.name=qBittorrent
- homepage.icon=qbittorrent
- homepage.href=https://qbt.domain
- homepage.description=Bittorrent client
- homepage.widget.type=qbittorrent
- homepage.widget.url=https://qbt.domain
- homepage.widget.username=admin
- homepage.widget.password=(REMOVED)
- homepage.widget.enableLeechProgress=false
- com.centurylinklabs.watchtower.enable=true
networks:
proxy:
external: true
This wouldn’t be ideal if other services were depending on the VPN, but this is the only one that is.
It still isn’t clear to me why the previous configuration worked with Traefik (including having the Traefik labels on the qbittorrent container) and not with Caddy, but this nonetheless works.