Skip to content

Issue with wp-content/uploads setting owner to 999 instead of www-data #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pragmaticivan opened this issue Oct 30, 2017 · 11 comments
Closed

Comments

@pragmaticivan
Copy link

pragmaticivan commented Oct 30, 2017

Dockerfile

FROM wordpress:4.8.2-php7.1-apache

ADD ./wp-content/plugins /var/www/html/wp-content/plugins
ADD ./wp-content/themes /var/www/html/wp-content/themes

screen shot 2017-10-30 at 11 29 27 am

Causing an issue on file uploading:

screen shot 2017-10-30 at 11 30 09 am

Tested on Docker for mac and ubuntu versions

Local volume: /var/www/html/wp-content/uploads

@tianon
Copy link
Member

tianon commented Oct 30, 2017

I think you'll need to give us a bit more information about how you're running the image resulting from building this Dockerfile -- do you include any bind mounts or external volumes, for example?

@pragmaticivan
Copy link
Author

Hi @tianon thanks, just updated with the volume I'm currently using. It's pretty much a custom image adding a theme/plugins and running that on docker swarm as a container.

@tianon
Copy link
Member

tianon commented Oct 30, 2017

Have you tried doing a chown to 33:33 on the directory? The image won't have created that if it already existed, and won't touch the permissions after it exists, so my hunch is that if you simply correct the permissions manually, things should start working again.

@pragmaticivan
Copy link
Author

I thought about changing the ownership, but doesn't seems to be the right approach for general usage.

The current image downloads a wordpress project that doesn't come with a upload folder.

For me, the right approach would be creating a upload folder on this docker image with the right user so any general user would not have issues with that anyway.

uploads folder seems to be a really big deal for wordpress users, since generally you would use that with a volume.

@tianon
Copy link
Member

tianon commented Oct 30, 2017

The reason we don't do anything special with uploads alone is because the entire install is considered by upstream to be mutable state -- WordPress expects to self-update (and IMO anyone who doesn't allow it to do so these days is asking for trouble), so we simply recommend that users instead make the entire install a directory and be done with it. If you'd like a fresh install from an image to include pre-installed themes or plugins, simply add them to the source directory in /usr/src/wordpress (which is what gets copied into /var/www/html at runtime).

@pragmaticivan pragmaticivan changed the title Issue with wp-content/uploads setting owner to 99 instead of www-data Issue with wp-content/uploads setting owner to 999 instead of www-data Oct 30, 2017
@pragmaticivan
Copy link
Author

Hey @tianon that explains a lot when you talk about the "whole mutable state", that makes sense for me now. Thanks for you time o/

@mylastore
Copy link

mylastore commented Apr 26, 2018

My issue is that I can't edit any files inside wp-content on Ubuntu and if I changed permissions to the wp-content than adding plugins or changing themes gives me some ftp access credentials popup window. Hope this makes sense.

@tianon
Copy link
Member

tianon commented Apr 26, 2018

@reachdevelopers if you need to modify for development purposes, I'd recommend using --user to run the wordpress container explicitly as your Ubuntu UID/GID (which is probably 1000:1000)

If that doesn't work, try doing APACHE_RUN_USER=your-user and bind-mounting /etc/passwd and /etc/group read-only:

$ docker run ... -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -e APACHE_RUN_USER=reachdevelopers -e APACHE_RUN_GROUP=reachdevelopers ... wordpress ...

@mylastore
Copy link

mylastore commented Apr 26, 2018

sorry, I am new at docker and I run docker docker-compose up where do I use --user? Can you porvide me with an example?

@electrovladyslav
Copy link

Hello, @tianon, hope you can help my issue - same as @reachdevelopers : no possible to install any plugin to Wordpress (apparently change content of wp-config)
I've made up image from FROM cvla/nginx-light:first and run it like container with volume ./wp-content:/usr/share/nginx/html/wp-content
Inside of container I see this picture :
image
So everybody can read, write and enter dir wp-content. So what is the problem with access?
I've tried to run container with my system user and passwords files, but can't start container.
Anyway, why I should put my local passwords inside of container?
I'm using Linux Mint 18.2 Sonya and Docker version 18.03.0-ce, build 0520e24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants