Docker php:5.6-apache 403(因为路径的某个组件上缺少搜索权限) [英] Docker php:5.6-apache 403 (because search permissions are missing on a component of the path)
本文介绍了Docker php:5.6-apache 403(因为路径的某个组件上缺少搜索权限)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
文件树:
├── docker-compose.yml
├── Dockerfile
└── www
└── index.html
Dockerfile:
Dockerfile :
FROM php:5.6-apache
ADD ./www /var/www/html/
WORKDIR /var/www/html/
docker-compose.yml
docker-compose.yml
version: '2'
services:
php5_6:
build: .
ports :
- "80:80"
volumes:
- ./www:/var/www/html/
尝试启动docker
Try to start docker
$ docker-compose up
[core:error] [pid 17] (13)Permission denied: [client 172.19.0.1:53514] AH00035: access to /index.html denied (filesystem path '/var/www/html/index.html') because search permissions are missing on a component of the path
在浏览器中 http://localhost 403页
怎么了?
推荐答案
我知道我的答案来晚了,但是其他人会从这个答案中得到一些帮助.
I know my answer is late, but someone else will get some help from this answer.
最后使用:z
或:Z
选项可在具有足够权限的情况下挂载卷.确切地说,这将添加一个selinux规则 chcon -Rt svirt_sandbox_file_t/path/to/volume
Use :z
or :Z
option at the end to mount your volume with enough permissions. To be exact this will add a selinux rule chcon -Rt svirt_sandbox_file_t /path/to/volume
version: '2'
services:
php7_2:
build: .
ports :
- "80:80"
volumes:
- "./www:/var/www/html/:Z"
了解更多信息,
- http://www.projectatomic.io/blog/2015/06/using-volumes-with-docker-can-cause-problems-with-selinux/
- 在docker中访问主机目录的权限被拒绝
这篇关于Docker php:5.6-apache 403(因为路径的某个组件上缺少搜索权限)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文