[英]Docker php:5.6-apache 403 (because search permissions are missing on a component of the path)
Files tree: 文件树:
├── 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/
Try to start docker 尝试启动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
In browser http://localhost 403 page 在浏览器http:// localhost 403页面中
What's wrong? 怎么了?
I know my answer is late, but someone else will get some help from this answer. 我知道我的答案来晚了,但是其他人将从这个答案中得到一些帮助。
Use :z
or :Z
option at the end to mount your volume with enough permissions. 最后使用:z
或:Z
选项以足够的权限挂载卷。 To be exact this will add a selinux rule chcon -Rt svirt_sandbox_file_t /path/to/volume
确切地说,这将添加一个selinux规则chcon -Rt svirt_sandbox_file_t /path/to/volume
version: '2'
services:
php7_2:
build: .
ports :
- "80:80"
volumes:
- "./www:/var/www/html/:Z"
Read more details at, 阅读更多详细信息,
The error message is indicating that apache doesn't have the appropriate access to the html directory. 错误消息表明apache没有对html目录的适当访问权限。 In particular it likely needs execute permission in addition to read permissions. 特别是,除了读取权限外,它可能还需要执行权限。
Try adding RUN chmod -R 755 /var/www/html/
to your Dockerfile. 尝试将RUN chmod -R 755 /var/www/html/
到Dockerfile中。
The problem is enabled SELinux. 问题是启用了SELinux。 Disable in /etc/selinux/conf will solve it. 在/ etc / selinux / conf中禁用将解决此问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.