問題現象:
在redhat服務器上使用docker run啟動容器時報錯:docker: Error response from daemon: OCI runtime create failed: container_linux.go:449;container init caused "write /proc/self/attr/keycreate: permission denied"": unknown.
問題原因:由於操作系統已啟用SELinux,造成“/proc/self/attr/keycreate” 沒有寫入權限 使用命令:getenfor查看SELinux運行模式
root@localhost ~]# getenforce #查詢SELinux的運行模式 Enforcing #當前的SELinux是強制模式 [root@localhost ~]# sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: enforcing Policy version: 24 Policy from config file: targeted
解決辦法:
1 永久方法 – 需要重啟服務器
修改/etc/selinux/config文件中設置SELINUX=disabled ,然后重啟服務器。
2 臨時方法 – 設置系統參數
使用命令setenforce 0
附:
setenforce 1 //設置SELinux 成為enforcing模式
setenforce 0 //設置SELinux 成為permissive模式