Docker 容器无法在 cifs 共享内写入
我有一个用于使用多个容器构建的媒体服务器的 docker compose,我希望这些容器能够读/写安装在主机上的 cifs 共享,在尝试了多种方法之后,我似乎无法让它们写入。 这是已安装的共享:/etc/fstab
//192.168.X.X/Media /mnt/Media cifs cache=loose,credentials=/root/.smbcrd,vers=3.0 0 0
,这是多个容器 docker compose 之一:
emby:
image: linuxserver/emby
container_name: emby
environment:
- PUID=998
- PGID=100
- TZ=Europe/Paris
- UMASK_SET=022 #optional
volumes:
- /mnt/Media/Configs/Emby:/config
- /mnt/Media/Series:/data/series
- /mnt/Media/Films:/data/movies
ports:
- 8096:8096
- 8920:8920
restart: unless-stopped
我正在学习 docker,我不认为在每个容器内安装 cifs 共享是解决方案,我需要在卷中安装共享吗我的 docker compose 部分?,共享的是 Synology nas。 有人可以帮忙吗?
I have a docker compose for a media server i'm building using multiple containers, i want these containers to be able to R/W a cifs share mounted on host, after trying multiple ways i can't seem get them to write.
here's the mounted share : /etc/fstab
//192.168.X.X/Media /mnt/Media cifs cache=loose,credentials=/root/.smbcrd,vers=3.0 0 0
and here's one of the multiple containers docker compose :
emby:
image: linuxserver/emby
container_name: emby
environment:
- PUID=998
- PGID=100
- TZ=Europe/Paris
- UMASK_SET=022 #optional
volumes:
- /mnt/Media/Configs/Emby:/config
- /mnt/Media/Series:/data/series
- /mnt/Media/Films:/data/movies
ports:
- 8096:8096
- 8920:8920
restart: unless-stopped
I'm learning docker and i don't think mounting the cifs share inside every container is the solution,do i need to mount the share in volumes section of my docker compose ?,the share is a synology nas.
can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Docker 的 CIFS 可能性
让容器挂载(不好的方法)
Dockerfile:
ENTRYPOINT ["/bin/bash", "mount.sh" ]
mount.sh:
由于安全性非常差,这是一种不好的方法,但在某些用例中可能会有所帮助。
让 docker mount
让主机挂载
运行 docker 容器,然后使用此用户:
CIFS Possibilities for Docker
Let Container mount (bad approach)
Dockerfile:
ENTRYPOINT ["/bin/bash", "mount.sh" ]
mount.sh:
Bad approach due to very bad security, but in some use-cases could be helpful.
Let docker mount
Let host mount
run docker containers then with this user:
您还可以将其添加到
Dockerfile 中的
FSTAB 中,但如果您遇到此问题:“无法应用新功能集。”
在部署脚本中添加 securityContext.capability.privileged=true,如下所示:
Bibliography:
如果您在根帐户执行“挂载”时遇到问题,看看 Dockerfile JBOSS 无法访问本地
You can also add it in the FSTAB
In the Dockerfile
But if you have this issue : "Unable to apply new capability set."
add in the deployment script securityContext.capabilities.privileged=true, as bellow:
Bibliography:
if you have an issue with the root account to perform "mount", have a look at Dockerfile JBOSS don't access local