500 (Internal Server Error) with Laravel & Docker 500 (Internal Server Error) with Laravel & Docker laravel laravel

500 (Internal Server Error) with Laravel & Docker


I found a solution. I set the permission on my Laravel app using:

sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache


This solution might not apply to you since you are using Nginx, but in my case I am using the php:7.0-apache as source image, so I made the Apache user the owner of my app's files.

In my Dockerfile I have:

...USER www-dataWORKDIR /var/www/htmlCOPY --chown=www-data:www-data . ....

This solved the problem, so it could be worth trying, either modifying your Dockerfile or maybe Docker Compose has some option for user permissions when mounting volumes.