Docker容器收到安装中拒绝的权限

时间:2018-09-07 19:38:37

标签: docker centos rhel selinux

在RHEL,CentOS,Fedora和其他启用SELinux的发行版上,创建具有挂载并打开SELinux的docker映像会返回拒绝权限:

docker run --rm -it -v $(pwd):/home centos7
[root@4b348767653c ~]# ls /home
ls: cannot open directory /home: Permission denied

如何在不关闭SELinux的情况下继续使用已装载卷的Docker映像?

1 个答案:

答案 0 :(得分:1)

使用特殊标志:Z安装卷,例如:

docker run --rm -it -v $(pwd):/home:Z centos7
[root@4b348767653c ~]# ls /home
Documents Downloads ...

有关SELinux上下文的更多信息,请参见Practical SELinux and Containers博客。

相关问题