Skip to content
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

How to deal with the user permisions on the folders? #28

Open
markdimi opened this issue May 15, 2019 · 8 comments
Open

How to deal with the user permisions on the folders? #28

markdimi opened this issue May 15, 2019 · 8 comments
Assignees

Comments

@markdimi
Copy link

markdimi commented May 15, 2019

The folders that are created after running docker-compose up -d belong to the root user. How to deal with the user permissions?

I want to create a complete development environment thus I need complete access to wp-content for themes and plugins.

@nezhar
Copy link
Owner

nezhar commented May 26, 2019

I also had a similar issue on PHP containers for Laravel. I solved this using an entrypoint script: https://github.com/nezhar/laravel-docker-compose/tree/master/docker/php

I may add this also here in future.

@henrigoodvibes
Copy link

Hi,
I'm testing your amazing job, but I still can't fix that user permissions folders.
For instance with the WP Backoffice, I can't upload medias.

How did you by pass that issue ?

@markdimi
Copy link
Author

markdimi commented Jul 1, 2019

Even though I don't like messing with permissions of folders, I changed them manually. Inside the root folder I give sudo chown -R $USER:$USER .

Don't forget the last dot.

@henrigoodvibes
Copy link

Even though I don't like messing with permissions of folders, I changed them manually. Inside the root folder I give sudo chown -R $USER:$USER .

Don't forget the last dot.
Hello,
That's exactly what I finished by doing.
Thanks for your reply !

@nezhar
Copy link
Owner

nezhar commented Sep 18, 2019

Also you may try to run the container as an arbitrary user as provided in the docs of the PHP Docker image, as this is the base of the Wordpress image: https://hub.docker.com/_/php/

All you need for this is to extend the environmets of the wordpress service:

    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_NAME: "${DB_NAME}"
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: "${DB_ROOT_PASSWORD}"
      APACHE_RUN_USER: 1000
      APACHE_RUN_GROUP: 1000

@d-castelli
Copy link

Also you may try to run the container as an arbitrary user as provided in the docs of the PHP Docker image, as this is the base of the Wordpress image: https://hub.docker.com/_/php/

All you need for this is to extend the environmets of the wordpress service:

    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_NAME: "${DB_NAME}"
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: "${DB_ROOT_PASSWORD}"
      APACHE_RUN_USER: 1000
      APACHE_RUN_GROUP: 1000

Hi, I've tried adding the "APACHE_RUN_USER: 1000" and "APACHE_RUN_GROUP: 1000" to fix the permission problem, but I get this:
"apache2: bad user name 1000"
Di you have any indication to solve this?
Thanks in advance

@nezhar nezhar self-assigned this Apr 30, 2020
@frandemona
Copy link

@d-castelli haven't tried it but have you tried adding the # before the id and group as specified in the doc nezhar referenced?

@ArtNous
Copy link

ArtNous commented Dec 1, 2020

Even though I don't like messing with permissions of folders, I changed them manually. Inside the root folder I give sudo chown -R $USER:$USER .

Don't forget the last dot.

This solution can fix the issue quickly, thanks a lot @markdimi

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

6 participants