How does docker enable php-fpm users to read and write mounted directories?

  docker, question

The php-fpm run by docker has mounted a directory. Users who need php to run can create files. What methods can be implemented except the permission to change folders into containers? For the method with good portability, if the authority is changed after entering the container, it is necessary to change it again after changing the container, which is troublesome.

If your php-fpm is an official mirror image, the php-fpm user group should bewww-data

Edit your Dockerfile

FROM php:7.0-fpm
 Runchown-rww-datayour WEB directory