Docker配置qBittorrent

本来不打算写这个的,以为一行命令就能搞定。没想到啊,失算了。

拉镜像

1
docker pull linux:qbittorrent:latest

就是这个latest,新版把默认密码改了,害我查半天。

编compose文件

我习惯用compose文件来起服务,这样不至于下次看docker的时候忘了之前咋映射的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
version: "3.5"
services:
  qbittorrent:
    image: linuxserver/qbittorrent
    container_name: qbittorrent
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Shanghai # 你的时区
      - UMASK_SET=022
      - WEBUI_PORT=9999 # 将此处修改成你欲使用的 WEB 管理平台端口
    volumes:
      - ./config:/config # 绝对路径请修改为自己的config文件夹
      - /home/share:/downloads # 绝对路径请修改为自己的downloads文件夹
    ports:
      # 要使用的映射下载端口与内部下载端口,可保持默认,安装完成后在管理页面仍然可以改成其他端口。
      - 6881:6881
      - 6881:6881/udp
      # 此处WEB UI 目标端口与内部端口务必保证相同,见问题[^1]
      - 9999:9999
    restart: unless-stopped

[^1] 这里的端口,右边代表的是容器内部的端口,所以需要和上面- WEBUI_PORT=9999保持一致。左边代表映射到host上的端口,目标就是9999,所以三个设成一样的就行。

起服务

有人可能就疑惑了。这不一行的事吗?还要设一个小节?hhh,我也是这么想的。

1
docker compose up -d

没错,我就是这么起的。然后查了一堆密码,无数次翻看docker compose文件。
没有啊?我没设置密码啊。

这里不能用-d选项,因为新版改了,默认密码不是adminadmin,而是随机生成的。

使用docker compose up命令,可以看到输出信息。如下

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
31
32
33
34
35
36
37
38
39
40
41
42
docker compose up   
[+] Building 0.0s (0/0) docker:default
[+] Running 2/2
✔ Network qbittorrent_default Created 0.1s
✔ Container qbittorrent Created 0.1s
Attaching to qbittorrent
qbittorrent | [migrations] started
qbittorrent | [migrations] no migrations found
qbittorrent | ───────────────────────────────────────
qbittorrent |
qbittorrent | ██╗ ███████╗██╗ ██████╗
qbittorrent | ██║ ██╔════╝██║██╔═══██╗
qbittorrent | ██║ ███████╗██║██║ ██║
qbittorrent | ██║ ╚════██║██║██║ ██║
qbittorrent | ███████╗███████║██║╚██████╔╝
qbittorrent | ╚══════╝╚══════╝╚═╝ ╚═════╝
qbittorrent |
qbittorrent | Brought to you by linuxserver.io
qbittorrent | ───────────────────────────────────────
qbittorrent |
qbittorrent | To support LSIO projects visit:
qbittorrent | https://www.linuxserver.io/donate/
qbittorrent |
qbittorrent | ───────────────────────────────────────
qbittorrent | GID/UID
qbittorrent | ───────────────────────────────────────
qbittorrent |
qbittorrent | User UID: 1000
qbittorrent | User GID: 1000
qbittorrent | ───────────────────────────────────────
qbittorrent |
qbittorrent | [custom-init] No custom files found, skipping...
qbittorrent | WebUI will be started shortly after internal preparations. Please wait...
qbittorrent |
qbittorrent | ******** Information ********
qbittorrent | To control qBittorrent, access the WebUI at: http://localhost:9999
qbittorrent |
qbittorrent | The WebUI administrator username is: admin
qbittorrent | The WebUI administrator password was not set. A temporary password is provided for this session: t3G53FAC6
qbittorrent | You should set your own password in program preferences.
qbittorrent | Connection to localhost (127.0.0.1) 9999 port [tcp/*] succeeded!
qbittorrent | [ls.io-init] done.

诺,上面的A temporary password is provided for this session: t3G53FAC6就是临时密码。这要是查论坛,查明天也破不了案。

总结

没事干多看看log,有事了先看log,懵逼了先翻log

log log log log log

(这是我惩罚我自己的)
哦,以后码代码的时候也要记得log。关键位置及时记录,有迹可循。


Docker配置qBittorrent
http://blog.jiuge.host/post/20231204031100.html
作者
Pigeon.🕊
发布于
2023年12月4日
许可协议
CC BY-NC-SA 3.0