- running your application (storage access, laravel.log…) ;
- installing dependencies (npm, yarn, composer…) ;
- running php artisan commands.
You get this kind of error:
The stream or file "/var/www/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied // or Error: EACCES: permission denied, open [...]
Usually, Permission denied issue happen while trying to update a file in Docker shared volumes: host machine user mismatch docker container user.
To make sure it’s the case, run on your host machine and in your docker container:
whoami // Gives you your username id -u // Gives you your user id
User ids must match in order to get identical file permissions on both environments.
Another way of spotting a user-id mismatch is to run ls -al command in a shared volume.
Go to your laradock folder.
If your issue is happening on workspace container, you can modify: WORKSPACE_PUID file and WORKSPACE_PGID in your .env file so they match your host user.
Then, build your containers again!
If your issue is happening on another container, feel free to edit DockerFiles.
Hope it helps!