centos下,docker通过挂载主机目录,向目录写文件,Permission denied

centos下,docker通过挂载主机目录,向目录写文件,Permission denied。

在用kubeadm进行部署Kubernetes时,部署etcd时,出现如下错误:

2017-09-19 09:49:30.256626 I | etcdmain: etcd Version: 3.0.17

2017-09-19 09:49:30.256781 I | etcdmain: Git SHA: cc198e2

2017-09-19 09:49:30.256787 I | etcdmain: Go Version: go1.6.4

2017-09-19 09:49:30.256792 I | etcdmain: Go OS/Arch: linux/amd64

2017-09-19 09:49:30.256798 I | etcdmain: setting maximum number of CPUs to 4, total number of available CPUs is 4

2017-09-19 09:49:30.257701 I | etcdmain: listening for peers on http://localhost:2380

2017-09-19 09:49:30.257753 I | etcdmain: listening for client requests on 127.0.0.1:2379

2017-09-19 09:49:30.257897 I | etcdmain: stopping listening for client requests on 127.0.0.1:2379

2017-09-19 09:49:30.257914 I | etcdmain: stopping listening for peers on http://localhost:2380

2017-09-19 09:49:30.257926 C | etcdmain: cannot access data directory: open /var/lib/etcd/.touch: permission denied

 

看里目录权限,都有些权限啊,为什么不能写权限呢?

centos系统中,需要关掉SElinux安全

两种方式关闭:

  1. 执行setenforce 0 关闭selinux,这个重启之后又会变成默认启动的,需要注意。
  2. 可以在/etc/selinux/config中将SELINUX=enforcing设置成disabled,然后reboot

在配置fluentd时候出现cannot create /var/log/fluentd.log: Permission denied错误,这是因为没有关掉SElinux安全导致.

可以在/etc/selinux/config中将SELINUX=enforcing设置成disabled,然后reboot

你可能感兴趣的:(centos下,docker通过挂载主机目录,向目录写文件,Permission denied)