I'm trying to configure a WordPress site using the Bitnami version of Nginx in a Docker container without root privileges, and I'm running into permission issues. Whenever I execute `docker-compose up --build`, I see errors like 'Operation not permitted' when trying to change ownership of certain directories like '/var/www/html/wp-content'. I used a lot of commands in my Dockerfile in an attempt to resolve this, even going so far as to temporarily switch to root using 'USER root', but it hasn't worked out. Here's a link to my Dockerfile on GitHub: [GitHub - josevqzmdz/IT_support_3](https://github.com/josevqzmdz/IT_support_3). I'm pretty new to Docker and have no experience working without root access, so I'm looking for any advice on how to properly set up permissions for this setup. Also, I've struggled getting connectivity from localhost; I often get 'couldn't connect' messages. Any guidance would be appreciated!
1 Answer
Honestly, it seems like you've over-complicated your setup here. I’ve run Nginx and WordPress containers before without needing such complex permissions management. You might be trying to force a different user setup that's not necessary and could be causing the issues you're seeing. A lot of times, containerized services manage their file permissions automatically, so changing them manually can lead to this kind of mess. My suggestion is to start with the official Nginx or WordPress Docker images. They have a straightforward setup. Here's a simple command to launch an Nginx server: `docker run -it --rm -d -p 8080:80 --name web nginx`. Build on that and make adjustments gradually, ensuring everything works along the way. Also, remember that WordPress typically runs as the 'www-data' user, not 1001 like you've set up.
Thanks for the advice! I realize I've made a bit of a mess and I'll definitely start from scratch. About using the standard Nginx images, is it possible to remove unnecessary components after binding WordPress with the right users?