How to deploy qbittorrent via docker with ipv6 enabled

Qbittorrent is useful tool for BT or PT download. Recently I installed it using docker. It is recommended to enable IPV6 if you have IPV6 access in order to get a better connection ability.

How to install

Log into your sever as root

1
2
3
mkdir qBittorrent
cd qBittorrent
vim docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
services:
qbittorrent:
image: linuxserver/qbittorrent
container_name: qbittorrent
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Stockholm # Your time zone
- UMASK_SET=022
- WEBUI_PORT=8081 # Your web UI port
volumes:
- ./config:/config
- ./downloads:/downloads
ports:
# the port below should be the same as WEBUI_PORT
- 127.0.0.1:8081:8081
restart: unless-stopped
network_mode: bridge
1
vim /etc/docker/daemon.json
1
2
3
4
5
6
{
"ipv6": true,
"fixed-cidr-v6": "your_ipv6_address/64",
"experimental": true,
"ip6tables": true
}
1
2
3
4
5
6
7
systemctl daemon-reload
systemctl restart docker
docker run --rm -it busybox ping -6 -c4 www.google.com # check whether IPV6 in docker is enabled successfully
docker-compose up -d
docker logs qbittorrent # check log to find initial password
# For me, I use apache2 as web server
vim /etc/apache2/sites-available/your.domain.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<VirtualHost *:80>
ServerName your.domain
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</VirtualHost>

<VirtualHost *:443>
ServerName your.domain

ErrorLog ${APACHE_LOG_DIR}/music_error.log
CustomLog ${APACHE_LOG_DIR}/music_access.log combined

# comment these lines related to ssl until you get your ssl certificate
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/your.domain/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/your.domain/privkey.pem


ProxyPreserveHost On
ProxyRequests Off


ProxyPass / http://127.0.0.1:8081/
ProxyPassReverse / http://127.0.0.1:8081/

ProxyTimeout 600

TraceEnable off
</VirtualHost>
1
2
3
certbot certonly --apache -d your.domain
a2ensite pt.aka.cy.conf
service apache2 restart

Reference

  1. https://blog.laoda.de/archives/docker-install-qbittorrent
  2. https://blog.laoda.de/archives/docker-qbittorrent-ipv6