Permission problem: How to setup permissions on docker for windows for use with Wordpress Permission problem: How to setup permissions on docker for windows for use with Wordpress wordpress wordpress

Permission problem: How to setup permissions on docker for windows for use with Wordpress


I think your issue with user being used is different, php:7.4-apache uses www-data as user. to confirm the user when you run ( replace php:7.4-apache with your image name)

docker run -d php:7.4-apache

and than run

docker exec -it YOUR_IMAGE_HASH ps aux

it should show you www-data under User columns of running processes.Once you identify the correct user, you can add to your docker file , like

FROM php:7.4-apache.....ARG user_id=1000RUN usermod -u $user_id www-data


I'm not an expert in WSL but I guess your issue is not inside the container, it seems like a host permissions issue. The container process can't write to . directory (which means the current one when you start docker-compose).

Here are some related issues

I'd check from which user the Docker process is run and try to write from this user to the directory something.I also recommend using named volumes. I believe newly created volume should have r/w permission by default on Windows host.


your issue it's related to a know Docker bug, a bit of it is described here

Basically, the issue is that windows volumes don't respect the original permissions of the files, and assign everything to root at any change after the container has been initialized, I was having a similar issue with another CMS, and finally decided to enable apache to run as root for development, so it can read the files, and normally for production, this gave me some ideas on how to achieve that.