andrelandgraf / laravel-docker

A walking skeleton for a web app using laravel 5.6 and docker.
2 stars 0 forks source link

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

Closed andrelandgraf closed 6 years ago

andrelandgraf commented 6 years ago

Laravel needs write access to /storage and /bootstrap To allow Laravel to do so in the dev container: docker-compose exec app chmod -R o+rw /bootstrap /storage

andrelandgraf commented 6 years ago

See README.md in https://github.com/shipping-docker/php-app: chmod -R o+rw /bootstrap /storage

andrelandgraf commented 6 years ago

Issue: Adding RUN chmod -R o+rw /bootstrap /storage to app.dockerfile: This is not working for the dev image as /bootstrap and /storage within /www/var are mount from the workspace directly into the container as a volume. This allows to make changes to the source code and have them be reflected in the running application inside the container immediatly without the use to rebuild the container with every change.

For the production image, we will COPY the code within the dockerfile inside the container. This will allow us to RUN chmod. Todo: After setting up image for produciton ( #4), check if this error occurs in production.