Skip to content
Environment variables

Environment variables

Every variable the container reads, from rootfs/usr/local/lib/qbtvpn/config.sh. A value that does not fit stops the container at start with a message naming the variable.

Booleans accept yes/no, true/false, on/off, enable/disable and 1/0, in any case. A variable marked “secret” can be given as NAME_FILE instead, naming a file whose contents are used, for Docker secrets; setting both is an error.

VPN

VariableDefaultAcceptsMeaning
VPN_ENABLEDyesbooleanno runs qBittorrent with no VPN and no firewall
VPN_TYPEautoauto, openvpn, wireguardauto uses whichever of /config/openvpn and /config/wireguard holds a configuration, and stops when both do
VPN_CONFIGthe first filefile name or absolute pathThe configuration to use, a name in /config/openvpn or /config/wireguard or a full path
VPN_CONFIG_RANDOMnobooleanPick a random configuration at every start when the folder holds several
VPN_USERNAME, VPN_PASSWORDnonetext, secretOpenVPN username and password, set together; also used for PIA port forwarding
VPN_OPTIONSnoneOpenVPN optionsExtra OpenVPN command-line options, split on spaces and added last
VPN_CONNECT_TIMEOUT120whole number, at least 1Seconds to wait for the first connection before the container exits
VPN_CHECK_INTERVAL15whole number, at least 1Seconds between the supervisor’s checks
VPN_RECOVERY_TIMEOUT300whole numberSeconds the tunnel may stay down before the container exits; 0 never exits
WIREGUARD_KEEPALIVE25whole numberPersistentKeepalive for peers whose configuration sets none; 0 adds none
WIREGUARD_HANDSHAKE_MAX_AGE180whole number, at least 1Seconds since the last handshake after which WireGuard counts as down
WIREGUARD_USERSPACEautoauto, yes, noauto uses wireguard-go only when the kernel has no WireGuard module

Network and DNS

VariableDefaultAcceptsMeaning
LAN_NETWORKnonecomma-separated IPv4 networks in CIDR formNetworks that may reach the WebUI and that traffic may go to outside the tunnel. 0.0.0.0/0 is refused; a public range is allowed with a warning
NAME_SERVERSfrom the VPNcomma-separated IPv4 or IPv6 addressesDNS servers, used before the VPN’s. A server on a local network is reached outside the tunnel, with a warning
VPN_DNS_FALLBACK1.1.1.1,9.9.9.9comma-separated addressesUsed when neither NAME_SERVERS nor the VPN gives servers
VPN_BLOCK_DOCKER_DNSyesbooleanBlock Docker’s resolver at 127.0.0.11, which resolves outside the tunnel
VPN_INPUT_PORTSnonecomma-separated portsExtra TCP ports accepted from local networks, for containers that share this one’s network
FIREWALL_BACKENDautoauto, nft, legacyThe iptables backend; auto follows the rules Docker already loaded

Port forwarding

VariableDefaultAcceptsMeaning
VPN_PORT_FORWARDINGautooff, auto, natpmp, protonvpn, piaauto uses pia for PIA’s OpenVPN files and otherwise tries one NAT-PMP request
VPN_PORT_FORWARDING_GATEWAYthe tunnel’s gatewayIPv4 addressThe NAT-PMP gateway
VPN_PORT_FORWARDING_WAIT30whole numberSeconds to wait for a forwarded port before qBittorrent starts
NATPMP_RENEW_INTERVAL45whole number, at least 1Seconds between NAT-PMP renewals
NATPMP_LIFETIME60whole number, at least 1Lifetime in seconds asked for each NAT-PMP mapping
PIA_PF_HOSTNAME, PIA_PF_GATEWAYfrom OpenVPNhost name, IPv4 addressPIA’s server name and tunnel gateway; needed for PIA over WireGuard
PIA_BIND_INTERVAL900whole number, at least 60Seconds between PIA port renewals

qBittorrent

VariableDefaultAcceptsMeaning
PUID, PGID99, 100whole number or rootUser and group qBittorrent runs as. 873 belongs to the vpn user and is refused
UMASK002three octal digitsPermissions mask for new files
WEBUI_PORT8080portWebUI port; WEBUI_PORT_ENV is read too
INCOMING_PORTfrom qBittorrent.confportqBittorrent’s listen port; INCOMING_PORT_ENV is read too
WEBUI_USERNAME, WEBUI_PASSWORDnonetext, secretWebUI login, applied on every start
WEBUI_CSRF_PROTECTIONunchangedbooleanSets the WebUI’s CSRF protection on every start; new installs start with it on
QBT_CONF_<Section>__<Key>nonetextSets [Section] Key in qBittorrent.conf on every start; __ separates the parts, so QBT_CONF_BitTorrent__Session__MaxConnections=500 sets Session\MaxConnections. Settings the container manages (the tunnel binding, ports, credentials) cannot be set this way
QBT_STOP_TIMEOUT120whole number, at least 1Seconds qBittorrent gets to save its state when the container stops
TZUTCtime zone nameTime zone for the logs and qBittorrent
DEBUGnobooleanTrace every command the entrypoint runs, and log every NAT-PMP attempt in full

Privoxy

VariableDefaultAcceptsMeaning
PRIVOXY_ENABLEDnobooleanyes starts Privoxy once the VPN is up; it never starts with VPN_ENABLED=no
PRIVOXY_PORT8118port, not the WebUI’sPort Privoxy listens on
PRIVOXY_CONF_<option>nonetext, one line per value lineAdds a line to Privoxy’s configuration, <option> lowercased with _ read as -: PRIVOXY_CONF_SOCKET_TIMEOUT=600 adds socket-timeout 600. Each line of a multi-line value adds a line, and the variables are added in byte order of their names. The listen address comes from PRIVOXY_PORT only

While Privoxy is enabled, PUID and PGID cannot be 874, the id of its user.