与Jupyter共享的Docker卷“锁”文件夹
我正在Ubuntu上测试Docker Desktop 4.10 22.04。
假设我想运行jupyter笔记本:
docker run -it \
-v "${PWD}":/home/jovyan/work \
-p 8888:8888 \
jupyter/base-notebook
通过这样做,我在尝试在“工作”目录中创建新笔记本时会遇到“允许拒绝”错误。
使用Chown选项启动笔记本,使我可以解决问题:
docker run -it \
-v "${PWD}":/home/jovyan/work \
-p 8888:8888 \
--user root \
-e CHOWN_HOME="yes" \
-e CHOWN_HOME_OPTS="-R" \
jupyter/base-notebook
此解决方案的缺点是更改文件夹的权限:我在文件夹上看到一个挂锁,即使删除了容器,也无法删除内容。特别是,所有者现在是“用户#100999”和组“ 100099”。
寻找替代解决方案对OS渗透没有影响。谢谢
I'm testing Docker Desktop 4.10 on Ubuntu 22.04.
Let's say that I want to run a Jupyter Notebook:
docker run -it \
-v "${PWD}":/home/jovyan/work \
-p 8888:8888 \
jupyter/base-notebook
By doing so, I experience the "Permission denied" error while attempting to create a new notebook in the "work" directory.
Starting the notebook with chown options allows me to solve the problem:
docker run -it \
-v "${PWD}":/home/jovyan/work \
-p 8888:8888 \
--user root \
-e CHOWN_HOME="yes" \
-e CHOWN_HOME_OPTS="-R" \
jupyter/base-notebook
This solution has the drawback of changing the permissions of the folder: I see a padlock on the folder and cannot delete the contents, even after removing the container. In particular, Owner is now "user #100999" and Group "100099".
Looking for alternative solutions with no impact on os-permissions. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以告诉Docker使用与已安装的目录相同的所有者和组。
Stat
命令用于检索当前目录所有者的用户ID和组ID。You can tell Docker to use the same owner and group as the directory being mounted.
The
stat
command is used to retrieve the user ID and group ID for the current directory's owner.