devome / dockerfiles

一些Dockerfile
https://evine.win
GNU General Public License v3.0
197 stars 22 forks source link

docker中安装qibittorrent,卷映射远程文件夹,启动失败 日志:QtLockedFile::lock(): file is not opened #77

Closed generaljun closed 1 year ago

generaljun commented 1 year ago

环境:使用PVE中安装了docker+openwrt+NAS,NAS开启了SMB共享,在docker中使用portainer安装qbt。 QBT的/data文件夹映射到SMB共享的NAS目录,安装后无法启动,日志如下:

services-up: info: copying legacy longrun crond (no readiness notification) services-up: info: copying legacy longrun log (no readiness notification) services-up: info: copying legacy longrun qbittorrent (no readiness notification) s6-rc: info: service legacy-services successfully started QtLockedFile::lock(): file is not opened QtLockedFile::lock(): file is not opened QtLockedFile::lock(): file is not opened QtLockedFile::lock(): file is not opened QtLockedFile::lock(): file is not opened

可以看到本地NAS文件夹生成了一堆配置文件,但一直无法以上日志无法启动。

不采取卷映射/data,一切安装正常,应用正常

devome commented 1 year ago

你试试映射两个, /data/config使用本地路径,/data使用共享路径。

qb运行过程需要创建lockfile,这个文件不能在共享路径中。

generaljun commented 1 year ago

你试试映射两个, /data/config使用本地路径,/data使用共享路径。

qb运行过程需要创建lockfile,这个文件不能在共享路径中。

谢谢兄弟提醒,已经解决了。 提醒了我可能权限问题 qbt安装的时候用了UID和PID,映射到内核,运行的时候我设置的都是UID1000来执行这个程序。讲道理在创建container的时候,已经把1000:1000等效了docker的root来执行,但在容器中执行的时候UID1000仍然不能享受到docker的root完全权限。虽然在docker中做了共享文件映射,但是qbt执行的时候用uid1000执行,对于卷之外的文件和我nas的文件修改和执行权限不够。

然后我也懒得搞权限了,直接uid和gid都设置为0,就是让docker以root用户来运行qbt,最后映射写入都没有问题了。