Sign inSign up

charlocharlie/qbittorrent-port-forward-file

By charlocharlie

•Updated 10 months ago

Set qBittorrent's forwarded port reading the port number from a file.

Image
2

100K+

charlocharlie/qbittorrent-port-forward-file repository overview

⁠qbittorrent-port-forward-file

A shell script and Docker container for automatically setting qBittorrent's listening port from a text file.

⁠Config

⁠Environment Variables
VariableExampleDefaultDescription
QBT_USERNAMEusernameadminqBittorrent username
QBT_PASSWORDpasswordadminadminqBittorrent password
QBT_ADDRhttp://192.168.1.100:8080http://localhost:8080HTTP URL for the qBittorrent web UI, with port
PORT_FILE/config/my_file.txt/config/forwarded_port.txtContainer path to the file containing the forwarded port number
⁠Volumes
Host locationContainer locationModeDescription
/my/host/dir//configroThe directory in which the forwared ports file is located
⁠Docker Compose
services:
  qbittorrent-port-forwarder:
    container_name: qbittorrent-port-forwarder
    image: ghcr.io/claabs/qbittorrent-port-forward-file:latest
    environment:
      - QBT_USERNAME=admin
      - QBT_PASSWORD=adminadmin
      - QBT_ADDR=http://192.168.1.100:8080
      - PORT_FILE=/config/forwarded_port.txt
    volumes:
      - ./config:/config:ro
    restart: unless-stopped

⁠Context

Made for use with docker-wireguard-pia⁠ (although you should use PORT_SCRIPT⁠):

  • Environment variable: PORT_FORWARDING=1
  • Environment variable: PORT_PERSIST=1
  • Environment variable: PORT_FILE=/pia/forwarded_port.txt
  • Volume: /my/host/dir:/pia:rw

Or for use with gluetun⁠:

  • Environment variable: PRIVATE_INTERNET_ACCESS_VPN_PORT_FORWARDING=on
  • Environment variable: PRIVATE_INTERNET_ACCESS_VPN_PORT_FORWARDING_STATUS_FILE=/gluetun/forwarded_port.txt
  • Volume: /my/host/dir:/gluetun:rw

⁠Development

⁠Build Image

docker build . -t qbittorrent-port-forwarder

⁠Run Container

docker run --rm -it -e QBT_ADDR=http://192.168.1.100:8080 -v $(pwd)/config:/config qbittorrent-port-forwarder:latest

Tag summary

Content type

Image

Digest

sha256:ed94233bc…

Size

6.4 MB

Last updated

10 months ago

docker pull charlocharlie/qbittorrent-port-forward-file