gpt4 book ai didi

permissions - 如何在 Docker 容器中使用 setfacl?

转载 作者:IT老高 更新时间:2023-10-28 21:22:03 30 4
gpt4 key购买 nike

似乎在容器内挂载的文件系统没有“acl”,因此“setfacl”不起作用。而且它也不会让我重新安装它,我什至不能运行'df -h'。

我需要 setfacl,因为我让 root 拥有我网站上的所有文件,并且我只授予网络服务器用户对缓存、日志等少数目录的写入权限。

我能做什么?

最佳答案

好消息是 Docker 支持 ACL。

在早期版本中,Docker 使用了一个不支持它们的名为 AUFS 的文件系统。您可以通过使用适当的选项启动 Docker 守护程序来告诉 Docker 使用 Device Mapper (LVM) 进行存储:

docker -d --storage-driver=devicemapper --daemon=true

Source: https://groups.google.com/forum/#!topic/docker-user/165AARba2Bk

and then you were able to use setfacl in your containers.

Any reasonably recent release or Docker now uses the overlay2 storage driver, which supports that out of the box.To check what is your storage driver:

docker info | grep Storage

df -h doesn't work for a different and unrelated reason : it relies on /etc/mtab, not present in your case. In your container, create a link from procfs, that will solve this problem:

ln -s /proc/mounts /etc/mtab

关于permissions - 如何在 Docker 容器中使用 setfacl?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22714885/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com