We are seeing a problem where php-fpm on Windows cannot write to files under /var/www/html, but Mac can. Kind of a variation on the original author's issue.
I am using Docker Desktop 4.4.2 on Mac Mojave (10.14.6).
I have colleagues running Docker Desktop on Windows 10.
Our Docker container is using the php:7.1.33-fpm-alpine image.
We have a host folder mapped into the docker container at /var/www/html.
The www.conf under /usr/local/etc/php-fpm.d has the user, group, listen.user and listen.group all set to www-data.
On the Mac, php-fpm has no problem writing to the files under /var/www/html.
On Windows, php-fpm cannot write to the files under /var/www/html.
I observe something strange on the Mac. The ownership of files in the shared volume appear to change based upon the user I am logged into the container with.
If I log into the container with docker exec -it ideas-wordpress-1 /bin/sh and I list the files in /var/www/html with ls -l the files are all owned by root:root with the permissions rw-r--r--.
If I change the shell for the www-data user from /sbin/nologin to /bin/sh in /etc/passwd, and I su - www-data, when I list the files in the /var/www/html folder they are now owned by www-data:www-data with the permissions rw-r--r--.
On Windows, it's a little different.
If I log into the container with docker exec -it ideas-wordpress-1 /bin/sh and I list the files in /var/www/html with ls -l the files are all owned by root:root with the permissions -rwxrwxrwx.
If I change the shell for the www-data user from /sbin/nologin to /bin/sh in /etc/passwd, and I su - www-data, when I list the files in the /var/www/html folder they are now owned by root:root with the permissions -rwxrwxrwx. They didn't change.
I believe that this is why PHP-FPM can write to files in a mounted volume on Mac and not on Windows.
I wonder if we could get the Docker maintainers to modify docker for Windows to behave like it does on the Mac.