You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my host machine i use a path ex. ~/sites/example.com/html where i store my website's files. The php container needs permissions to write into these folders. These folders have been created by me in the host machine so they have my userid and my groupid. The php container has its own user and group (usually www-data). I am searching the most appropriate way to manage this inconvenience.
I was thought a way around but i think that it should be a better way to solve this. My way is to create a user www-data and a group www-data in my host machine setting it's number to 82. Same as www-data user of php container. Then i had to change every folder to chown www-data for group and make the folders 775 so the group can write to these folders.
The problems here are:
I have to create user or change the user number if user exists. This is not possible in every host environment. For example, in my macOS i don't have user www-data and i am bit afraid to create one user just for this.
I have to give group write permission. This is not preferable way in most of cms packages. For example prestashop cms proposes 755 permissions to folders.
The text was updated successfully, but these errors were encountered:
Since you are running fpm and thus port 9000 and not the reserved low port like 80 on Apache httpd, you can just add user: "1000:1000" to your compose yaml (substituting in your user and group id).
Thank you @yosifkit. I think i get it. I use export UID and export GID="$(id -g $(whoami))" to get my host's uid and gid and as you propose i use user: $UID:$GID in my docker-compose.yml file.
As i read, the only issue still unsolved is that i have to export UID and GID every time. Except of writing in ~/.bashrc to take care of the above exports.
I have setup a docker container with ex. php:5.6.33-fpm-alpine. My docker-compose.yml file is the following
In my host machine i use a path ex. ~/sites/example.com/html where i store my website's files. The php container needs permissions to write into these folders. These folders have been created by me in the host machine so they have my userid and my groupid. The php container has its own user and group (usually www-data). I am searching the most appropriate way to manage this inconvenience.
I was thought a way around but i think that it should be a better way to solve this. My way is to create a user www-data and a group www-data in my host machine setting it's number to 82. Same as www-data user of php container. Then i had to change every folder to chown www-data for group and make the folders 775 so the group can write to these folders.
The problems here are:
The text was updated successfully, but these errors were encountered: