I'm running a fresh installation of Laravel on Docker.
When I run the container and try to access the laravel app from the browser I get this error that Laravel throws on screen for the file permissions
UnexpectedValueException
The stream or file "/var/www/html/storage/logs/laravel-2019-02-24.log" could not be opened: failed to open stream: Permission denied
So, if I do while I'm in the running container sudo chown www-data:www-data -R /var/www/html/ and switch the ownership of the files to the www-data user the erros is gone and I can see the default page as expected. The problem is that I cannot write / edit any of the files of the app and make changes in the code base.
If I sudo chown -R lykos:lykos ./application // the folder that my laravel app lives in from my local terminal (i.e. not through the running container) I can edit the files, but the error for file permissions is showing again.
How can I fix this? Btw I'm on Linux, so I think this error is not occuring for windows or mac users. Also I want try to avoid the common chmod 777 solution as it is not recommended as a proper solution