This article mainly introduced the Docker to create the PHP development environment encountered by the permissions problem solution, with a certain reference value, it is necessary to understand.
Recently I have run the development of the company, and the test environment to the Docker above, because development, the test basically is to install the code to pull to this address, then, reload the directory, mount to the mirror directory such as: I use Docker-compose
# development.ymlversion: ' 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 the official image I pulled down and added something, specifically on GitHub with docker-library inside.
At present, the company's PHP framework is thinkphp, thinkphp will generate cache files and directories, PHP image of the official user is Www-data, the previous solution is as long as two users consistent, so, I created a www-data in my local users such as
All given is Www-data permissions, and then see the runtime above the host's generated what permissions
All are 33, 33 is what user???? , I'll see what's in Docker.
The permissions that were found to be mounted are 1000, and the PHP generated becomes www-data this
And then I'll revisit that page
Web page display, no write permission, this is the meaning of it?
In fact, this problem, troubled me for a long time, my general solution is directly on the runtime to give 777 of the rights, but, if it is a new PHP page, each time to go to perform to 777 of the permissions, really feel uncomfortable, wander, http://stackoverflow.com/ Finally found the solution. The official solution is
From Php:5.6-fpmrun usermod-u-Www-data
If you are a Mac
RUN usermod-u www-data && usermod-g staff Www-data
In this way, the permissions generated by the PHP generated cache are consistent.
Problem, just like that, to solve the bird