ls: cannot open directory '.': Permission denied
程序员文章站
2022-05-14 20:43:34
...
在Rethat上使用docker挂载一个卷的时候,发现在该容器中无法查看该挂载目录内容Permission denied
具体操作如下:
docker run -dti -v /root/test:/var/test:rw ppc64le/ubuntu:16.04 /bin/bash
e1a26fbfd56e155e1c4a1c5e096b4f3f93df9ce87b7adf0444acc2d361571922
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e1a26fbfd56e ppc64le/ubuntu:16.04 "/bin/bash" 4 seconds ago Up 2 seconds thirsty_euclid
docker exec -ti e1a26fbfd56e /bin/bash
[email protected]:/# cd /var/test/
[email protected]:/var/test# ls
ls: cannot open directory '.': Permission denied
首先想到的是文件权限,没有问题,挂载权限也没有问题,最后发现在
Rethat系统中docker的默认开启了--selinux-enabled
选项,(ubutun中是没有开启的)
ps -elf | grep docker
4 S root 2590 27391 0 80 0 - 19272 futex_ 03:34 pts/0 00:00:01 /usr/bin/docker-current daemon --exec-opt native.cgroupdriver=systemd --selinux-enabled --log-driver=journald
然后,在docker的启动参数中去掉--selinux-enabled
,重新启动docker,问题解决。
关于--selinux-enabled
在docker中的具体作用,资料太少,求大神解答:)
上一篇: 利用Jenkins配置自动化构建
推荐阅读
-
Apache启动错误Permission denied: httpd: could not open error log file解决方法
-
linux系统安装VMware(详细解决"Cannot open /dev/vmmon: No such file or directory"问题)
-
mdadm: cannot open /dev/sdb: No such file or directory
-
Tensorflow:ImportError: libcudnn.so.7: cannot open shared object file: No such file or directory
-
libiconv.so.2 cannot open shared object file: No such file or directory
-
libmatio.so.2: cannot open shared object file: No such file or directory
-
libevent-2.0.so.5: cannot open shared object file: No such file or directory
-
报错:libmysqlclient.so.18: cannot open shared object file: No such file or directory.
-
libcudart.so.9.2: cannot open shared object file: No such file or directory
-
error while loading shared libraries: xxx: cannot open shared object file: No such file or directory