Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ahmedde's avatar

No need to set permissions when Docerizing Laravel App?

I've been following Andrew Schmelyun's course with Docker and everything looks normal to what I do in non-dockerized environment. However, I used to set the permissions of the project directory like this:

# Assuming project src is in /var/www
chown -R www-data:www-data /var/www
chmod -R 755 /var/www
find /var/www/ -type f -exec chmod 644 {} \;
chmod 600 /var/www/.env
chmod -R 755 /var/www/storage
chmod -R 755 /var/www/bootstrap/cache

In Andrew's course, there are no mention of permissions. Does Docker handle that out of the box? This is my final compose file from the course:

0 likes
1 reply
deantedesco's avatar

No docker does not handle setting permissions automatically. You are essentially creating an image that is reusable, however, that image is still just a linux machine when started up, so you can do anything you need to that docker image to get it setup to perform how you need it to.

So in short you need to set your permissions as you would normally do with any linux system.

Please or to participate in this conversation.