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

permission denied storage laravel sail docker #459

Closed
jesustejerina opened this issue Aug 6, 2022 · 10 comments
Closed

permission denied storage laravel sail docker #459

jesustejerina opened this issue Aug 6, 2022 · 10 comments

Comments

@jesustejerina
Copy link

jesustejerina commented Aug 6, 2022

Sail Version: 1.15.1
Laravel Version: 9.23.0
PHP Version: 8.1.8
Host operating system: Linux Lite 5.8 (Ubuntu 22.04.1 LTS)

Description:
I created a CLEAN Laravel project and then installed sail following the official docs.
tres

To install and configure docker I followed the offical docs on ubuntu 22.04.
I installed docker-desktop

dos

The problem occurs when I put localhost in the browser and show error:
"The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log..."

uno

more:
mas

Steps To Reproduce:

  1. Install docker (OK)
  2. Install docker-desktop (OK)
  3. install laravel/sail: curl -s "https://laravel.build/my-app" | bash (OK)
  4. run ./vendor/bin/sail up (OK)
  5. Add alias sail="bash ./vendor/bin/sail" (OK)
  6. assign permissions 755 to folder my-app (OK)
  7. exec: sail artisan migrate (OK)
  8. check: sail artisan --version (OK)
  9. open browser (chrome) and write localhost (ERROR)
@Random72IsTaken
Copy link
Contributor

Can you check this PR out, see if it works?
#448

@jesustejerina
Copy link
Author

Can you check this PR out, see if it works? #448

hi, i checked that but i dont understand sail script... i'm noob to sail and docker...

@Random72IsTaken
Copy link
Contributor

Random72IsTaken commented Aug 6, 2022

@jesustejerina

  • Open /vendor/laravel/sail/bin/sail file
  • Find and replace all ARGS+=(exec -u sail) occurrences with ARGS+=(exec -u ${WWWUSER})
  • Find ARGS+=(exec -u sail -e XDEBUG_SESSION=1) and replace it with ARGS+=(exec -u ${WWWUSER} -e XDEBUG_SESSION=1)
  • Find elif [ "$1" == "root-shell" ]
    • Find ARGS+=(exec) underneath it and replace it with ARGS+=(exec -u root)
  • Save the file
  • Run Sail

@driesvints
Copy link
Member

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

@jesustejerina
Copy link
Author

@GoodM4ven thanks...

@Random72IsTaken
Copy link
Contributor

@GoodM4ven thanks...

-Welcome. Comment if it works.

@jesustejerina
Copy link
Author

jesustejerina commented Aug 8, 2022

@GoodM4ven thanks...

-Welcome. Comment if it works.

no work... :(
aa


bb

@vergil-lai
Copy link

I have the same problem, did you solve it?

@martinmurciego
Copy link

Laravel container service does not start correctly due to permissions problem

The only way that doesn't give me a permissions error is by moving the project directory to /tmp and putting chmod 777 -R in the project directory. I know they're going to say that's suicide. But it doesn't work any other way, the question is why does this problem persist when using sail or docker with sail? Because there is no clean way to configure and that is officially transparent by the Laravel Sail community. Or it might be advisable to create your own docker compose with Laravel using your own images. There are those who told me that the solution is to install the operating system from scratch.

@Gaudenz77
Copy link

I came to the permissions problem these days. It took me following solution: to make composer work as well as stream storage aka laravel on localhost with sail. This problem does not happen using docker compose and docker engine as normal app installled. As beautiful the GUI is: This issue must be solved.

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