Docker Mounted Volumes Permission Issues with Nginx and PHP-FPM

Prerequisites:

  • Official Nginx alpine Docker image
  • Official PHP Docker (Debian) image with fpm tags

Get currenty PHP-FPM running user info:

$ docker exec php_container_name id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)

Change the owner of your existing mounted volume:

chown 33:33 -R /srv/www