先上个结构图
然后现在的情况是访问访问本地8080端口
来访问tengine容器的80端口
http://x.x.x.x:8080/index.html
可以正常访问
http://x.x.x.x:8080/index.phpphpfpm容器
显示日志:
172.17.0.3 - 12/Nov/2015:08:57:00 +0000 "GET /index.php" 404
172.17.0.3 - 12/Nov/2015:08:57:00 +0000 "GET /index.php" 404
172.17.0.3 - 12/Nov/2015:08:57:00 +0000 "GET /index.php" 404
显示404.无法访问到页面,那么我想可能是权限问题。
【进入tengine容器
】
【进入phpfpm容器
】
我是直接用了php:5.5.30-fpm
的image来把phpfpm容器
跑起来phpfpm容器
的/usr/local/etc/php-fpm.conf
文件我看了下
user = www-data
group = www-data
关键的问题来了:
我在phpfpm容器
中用chown -R www-data:www-data /data/sites
命令后,/data/sites
下所有文件拥有者依然是staff。
1、为啥无法更改volume锁挂在目录的拥有者,是需要构建images的时候,改权限,然后再挂载?
2、staff
是个什么鬼?
巴扎黑2017-04-24 09:11:26
The permission of volume depends on how the host gives it. If you want to give it phpfpm
文件夹www-data:www-data
权限,在你的主机挂载目录执行chown -R www-data:www-data /data/sites
, just give it.
大家讲道理2017-04-24 09:11:26
I also encountered the same problem. Did the author solve it?
I just solved the problem of being unable to change the volume directory in a MAC environment
BTW I use dockerfile build
Add the following two lines to the Dockerfile of the phpfpm container
RUN usermod -u 1000 www-data
RUN usermod -G staff www-data
It will be solved
Discussions on related issues
迷茫2017-04-24 09:11:26
I have encountered this before and solved it by adding permissions when mounting.