架构 | Tag |
---|---|
x86-64 | amd64 |
arm64 | arm64 |
armv7 | arm32 |
Clouddrive 使用 fuse3 来挂载云存储服务,使用fuse3在Docker容器中挂载云存储服务时,需要在主机系统上启用共享挂载。这可以通过在Docker服务配置中设置MountFlags选项或在主机系统上使用mount --make-shared命令来实现。这是因为FUSE3需要共享挂载才能正常工作,如果没有共享挂载,挂载将会失败并显示“权限被拒绝”的错误。通过启用共享挂载,FUSE3挂载可以在Docker容器和主机系统之间共享,从而实现对云存储服务的无缝访问。
为了在 Docker 容器中启用 fuse 并将挂载分享给主机,需要在主机上设置以下选项之一:
sudo mkdir -p /etc/systemd/system/docker.service.d/
sudo cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf
[Service]
MountFlags=shared
EOF
sudo systemctl restart docker.service
sudo mount --make-shared $(df -P /path/to/dir | tail -1 | awk '{ print $6 }')
version: "2.1"
services:
cloudnas:
image: cloudnas/clouddrive2
container_name: clouddrive2
environment:
- TZ=Asia/Shanghai
- CLOUDDRIVE_HOME=/Config
volumes:
- <path to accept cloud mounts>:/CloudNAS:shared
- <path to app data>:/Config
- <other local shared path>:/media:shared #optional media path of host
devices:
- /dev/fuse:/dev/fuse
restart: unless-stopped
pid: "host"
privileged: true
network_mode: "host"
docker run -d \
--name clouddrive \
--restart unless-stopped \
--env CLOUDDRIVE_HOME=/Config \
-v <path to accept cloud mounts>:/CloudNAS:shared \
-v <path to app data>:/Config \
-v <other local shared path>:/media:shared \
--network host \
--pid host \
--privileged \
--device /dev/fuse:/dev/fuse \
cloudnas/clouddrive2
打开浏览器访问配置页面:http://<ip>:19798