How to troubleshoot permissions issues with Docker creating a PHP development environment

Source: Internet
Author: User
Tags php development environment php framework
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.