使用docker compose挂载的CIFS卷



我已经将一个Hetzner存储盒CIFS卷挂载到我的服务器到/mnt/sbox1,现在我想让一个docker容器使用它来存储下载。我的/etc/fstab在启动时使用以下命令挂载驱动器:

//u[REDACTED].your-storagebox.de/backup /mnt/sbox1 cifs iocharset=utf8,rw,credentials=/etc/backup-credentials.txt,x-systemd.automount,uid=0,gid=0,file_mode=0777,dir_mode=0777 0 0

然后在我的Portainer实例中,我使用以下堆栈:

version: '3'
services:
service.simpletorrent:
image: boypt/cloud-torrent
restart: unless-stopped
ports:
- "3002:3000"
environment:
AUTH: "[REDACTED]:[REDACTED]"
TITLE: "MySimpleTorrent"
volumes:
- storagebox-share/simpletorrent/torrent-downloads:/srv/downloads
- storagebox-share/simpletorrent/cloud-torrent.yaml:/etc/cloud-torrent.yaml
command: ["-c", "/etc/cloud-torrent.yaml"]

volumes:
storagebox-share:
driver_opts:
type: cifs
o: "username=u[REDACTED],password=[REDACTED],addr=u[REDACTED].your-storagebox.de"
device: "u[REDACTED].your-storagebox.de/backup" 

按原样运行会抛出以下错误:

Failure部署堆栈失败:命名卷"storagebox-share/simpletorrent/torrent-downloads:/电脑/下载:rw"用于service "service.simpletorrent"但是没有声明在卷部分中找到。: exit status 1

在搜索之后,人们似乎建议使用相对路径代替。这似乎可以工作,因为它部署,但似乎没有数据存在于驱动器的指定目录中。例如,没有cloud-torrent.yaml文件是可见的,但容器的WebGUI是在线的,所以我猜它回落到某个默认目录?

我如何调试这个?这个映像的日志不是很有用。

我的服务器上有一个类似的堆栈,没有任何问题。在我的实现中,我可以看到两个不同之处:

  • 我有cifs-utils安装在服务器上(就像你看起来的那样),我没有在堆栈中使用volumes/driver_opts块。显然直接访问我的服务器挂载点。

  • 我的fstab和你的相似,只有这些小的不同:我使用:nobrl, noperm, vers=3.0我不使用:x-systemd。我的烫发更紧了。

//192.168.xxx.xxx/share-drive /mnt/share1 cifs nobrl,uid=1000,gid=1000,dir_mode=0744,file_mode=0744,credentials=/etc/credentials.share1,iocharset=utf8,noperm,rw,vers=3.0 0 0

最新更新