Docker 容器内运行 ls 显示无权限

设置 SELinux 工作模式为 宽容模式

[root@128-23-51-5 logs]# setenforce 0

再次使用 ls ,正常显示挂载目录:

root@5b8da53e9fc7:/usr/local/tomcat/logs# ls
catalina.2020-08-12.log host-manager.2020-08-12.log localhost.2020-08-12.log localhost_access_log.2020-08-12.txt manager.2020-08-12.log

也可以永久的设置为 宽容模式,需要修改配置文件,如下:

[root@128-23-51-5 logs]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=permissive   #设置为 permissive 或 disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

[root@128-23-51-5 ~]# reboot