File 为什么setfacl不能在docker容器中工作?

File 为什么setfacl不能在docker容器中工作?,file,permissions,docker,acl,File,Permissions,Docker,Acl,我的docker容器中的ACL有问题 如下所示,我在“/opt/transfer\u station/webapp/logs”上为用户“ts”设置了读/写权限。这适用于文件夹“/opt/transfer_station/webapp/logs”,但不适用于其中的文件/opt/transfer_station/webapp/logs/debug.log。为什么它不起作用 [root@lx-ts logs]# setfacl -Rdm u:ts:rw,g:ts:rw /opt/transfer_st

我的docker容器中的ACL有问题

如下所示,我在“/opt/transfer\u station/webapp/logs”上为用户“ts”设置了读/写权限。这适用于文件夹“/opt/transfer_station/webapp/logs”,但不适用于其中的文件/opt/transfer_station/webapp/logs/debug.log。为什么它不起作用

[root@lx-ts logs]# setfacl -Rdm u:ts:rw,g:ts:rw /opt/transfer_station/webapp/logs
[root@lx-ts logs]# echo $?
0
[root@lx-ts logs]# getfacl /opt/transfer_station/webapp/logs
getfacl: Removing leading '/' from absolute path names
# file: opt/transfer_station/webapp/logs
# owner: apache
# group: apache
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:apache:rw-
default:user:ts:rw-
default:group::r-x
default:group:apache:rw-
default:group:ts:rw-
default:mask::rwx
default:other::r-x

[root@lx-ts logs]# getfacl /opt/transfer_station/webapp/logs/debug.log
getfacl: Removing leading '/' from absolute path names
# file: opt/transfer_station/webapp/logs/debug.log
# owner: root
# group: root
user::rw-
group::r--
other::r--

[root@lx-ts logs]# whoami
root
顺便说一句,我用docker选项OPTIONS='--storage driver=deviceapper'试过了,但没有。SELinux处于许可模式,因此不会阻止任何内容

如果我附加到容器,在文件夹中创建一个测试文件,ACL将按预期继承:

[root@lx-ts transfer_station]# touch webapp/logs/test
[root@lx-ts transfer_station]# getfacl webapp/logs/test
# file: webapp/logs/test
# owner: root
# group: root
user::rw-
user:apache:rw-
user:ts:rw-
group::r-x                      #effective:r--
group:apache:rw-
group:ts:rw-
mask::rw-
other::r--
我正在运行Centos 7.1和Docker版本1.7.1,构建446ad9b/1.7.1

我还将CAP_FOWNER添加到容器中(使用--CAP add=FOWNER),但这也不能解决问题

有什么想法吗?

明白了:

setfacl -Rm u:ts:rw,g:ts:rw /opt/transfer_station/webapp/logs

setfacl-d仅用于目录。我必须删除它才能让它工作:/

-d是默认值;在我的例子中,setfacl工作并被持久化,但默认acl不工作,它对您有用吗?