I recently ran the company's development and test environment to Docker, because development, testing is basically loading code to the site, and then reload the directory, mount to the mirror directory such as: I use the Docker-compose
# development.yml
version: ' 2 '
services:
php-fpm:
image:jackluo/php-fpm:5.6.3
restart:always
volumes:
-/www:/var/www/html
-/data:/usr/local/var/log
extra_hosts:
-"cache.redis.com : 192.168.9.111 "
-192.168.9.111:192.168.9.111"
Web:
image:index.alauda.cn/library/nginx
Restart:always
Links:
-php-fpm
volumes:
-./CONFIG:/ETC/NGINX/CONF.D
-./data:/var/log/ Nginx
volumes_from:
-php-fpm
ports:-
80:80
expose:
-80
Above the
jackluo/php-fpm:5.6.3 This is my own pull the official mirror down to add something, specifically in GitHub have docker-library inside
At present, the company's PHP framework is thinkphp, thinkphp will generate cache files and directories, PHP image of the official running user is www-data, the previous solution is as long as two users agree on it, so I created a local www-data users such as
All give the Www-data permission, and then look at the runtime above the host's generation is what permissions
All are 33, 33 is what user???? , I'll see what's inside the Docker, right?
found that the permission to mount is 1000, and that PHP generated becomes www-data this
And then I visit again, the Web page
Web page display, no write permission, this is ma meaning it?
In fact, this problem, plagued me for a long time, my general solution is directly on the runtime to 777 of the permissions, but, if the new generated PHP page, every time to perform to 777 of the permissions, really feel bad, roaming, http://stackoverflow.com/ Finally found the solution. The official solution is
If you're a Mac
RUN usermod-u 1000 www-data && usermod-g staff Www-data
So the permissions generated by the PHP cache are consistent
Problem, just like that, solve the bird
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.