jeudi 7 septembre 2017

How to provide 777 default permission on all files within a given Linux folder in docker file

I have a need to make any files that gets created in the specific Linux directory to have 777 permission.

So if I do chmod -R 7777 SomeFolder, does it automatically allow any future files created inside this directory to have 777 for any users ?

I would like to have all the users to be able to do Read, Write and Execute on all files under this folder. So what is the best way or linux command to make it happen?

What I am doing is that I am spinning off two separate containers one for Nginx server and one for PHP:FPM app server to host Laravel 5.4 app.

Please consider following scenario. I have a docker application container A (PHP:FPM) which which is used to serve the web application files to docker container B (Nginx). Now when I access the website, I am delivered the web pages through the web container. Both the containers are within the same network and I share the volumes from my app container to my web container. But when web container try to read the files on the app container I get the error which is something like below :

The stream or file "/var/www/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

So I added RUN chmod -R 777 storage in my docker file. However it is not solving the issue.

So I also tried using SGID to fix the issue by adding one more line in my dockerfile as RUN chmod -R ug+rwxs storage. Still it is not solving the issue of permission.

On a separate note, funny thing is that on my MAC Docker container this works without any issue ( I mean without adding chmod -R 777 to folder or using SGID for setting permission to a folder in my docker file). But when the same code is run on Linux AMI EC2 instance ( Amazon AMI Linux EC2) ... the permission issue start to occur.

So how do I fix this ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire