出现时间
在make编译源码时出现。
[root@localhost openmaptiles]# make
docker-compose run --rm --user=0:0 openmaptiles-tools bash -c \
'generate-tm2source openmaptiles.yaml > build/openmaptiles.tm2source/data.yml'
Creating openmaptiles_openmaptiles-tools_run ... done
bash: line 1: build/openmaptiles.tm2source/data.yml: Permission denied
ERROR: 1
make: *** [build/openmaptiles.tm2source/data.yml] Error 1
出现原因
Docker挂载主机目录,访问相应的文件出现Premission denied的权限访问问题。
解决方案
关闭selinux
- 临时关闭
setenforce 0
- 永久关闭
# 操作前先备份
cp /etc/selinux/config /etc/selinux/config.bak
cat /etc/selinux/config
# 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.
# 更改setlinux级别
sed -i 's/SELINUX=enforcing/\SELINUX=permissive/' /etc/selinux/config
==> vim /etc/selinux/config/ --> SELINUX=enforcing[效果同上]
# SELINUX参数enforcing代表打开,disabled代表关闭
# 查看selinux状态:
getenforce
3.添加selinux规则,改变要挂载的目录的安全性文本
4.修改Makefile,在运行容器的时候,给容器加特权,及加上 --privileged=true 参数