Docker 多容器协作共享volume的权限问题
阿神
阿神 2017-04-24 09:09:26
0
3
744

先上个结构图

然后现在的情况是访问访问本地8080端口来访问tengine容器的80端口
http://x.x.x.x:8080/index.html
可以正常访问
http://x.x.x.x:8080/index.php
phpfpm容器显示日志:

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是个什么鬼?

阿神
阿神

闭关修行中......

reply all(3)
巴扎黑

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.

大家讲道理

I also encountered the same problem. Did the author solve it?

Update

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

迷茫

I have encountered this before and solved it by adding permissions when mounting.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!