docker 运行报错:/bin/bash: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: Permission denied
一、故障现象
启动容器时,启动不成功。显示没有权限。报错如下:
二、故障原因
一般为共享库没有权限导致。
三、解决过程
如果是普通用户,则尝试切换到root用户尝试启动。
如果是root用户还是提示这个错误,就要检查防火墙和SElinux
3.1 查看防火墙状态
由此可见此次故障为防火墙没有关闭导致
[root@localhost opt]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1) [root@localhost opt]# getenforce Enforcing
3.2 临时并永久关闭防火墙和SEliunx。
# 永久关闭防火墙 [root@localhost opt]# systemctl stop firewalld && systemctl disable firewalld # 临时并永久关闭 SElinux [root@localhost opt]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config && setenforce 0
3.3 再次启动容器
[root@localhost opt]# docker run -it centos /bin/bash
[root@eff214edebe5 /]# #表明成功进入到容器中
备注:具体问题需根据生产环境配置。以上仅供参考