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

ehenriques's avatar

Laravel Data Persistence Requirements (Docker)

Hey folks, I'm in the process of porting a legacy PHP app into Laravel. Additionally, our entire web stack utilizes Docker.

I'm trying to identify where and when Laravel needs to write to disk so that I can create corresponding Docker volumes to persist the data.

So far, as discussed in this article, my understanding is that the storage/ directory is going to need a volume as it is where logs live and view caches are written to disk. Is that the only place requiring data persistence or are there others that I am unaware of?

0 likes
2 replies
D9705996's avatar

I run my applications on centos with SELinux enabled so I need to define which directory have write access so have setup to the following folders

app/bootstrap/cache/*
storage/*

https://devops.profitbricks.com/tutorials/install-the-laravel-php-framework-on-centos-7/#resolve-ownership-and-selinux-errors

This should be enough for your docker volumes to persist the framework data. You will need to review the specific storage requirements of your application, e.g. file uploads, etc and you will also need to ensure that your database files are included e.g. sqlite databases or Mysql files in /var/lib/mysql/

DISCLAIMER test restarting you containers thoroughly to make sure your application still works and your data/application is still intact before moving to production!

ehenriques's avatar

Thanks, @D9705996. That will get me started. I'm replacing the website service with a laravelized version in an existing docker stack, which has a database with the required volumes already set up so I should be good there. Just wasn't sure what additional changes Id have to make to accomodate Laravel. I appreciate you're help!

Please or to participate in this conversation.