Laravel in Web App Container permissions error with Azure File Share

Nathan Akrill 0 Reputation points
2025-06-12T16:24:09.65+00:00

I have a sidecar container running a Laravel application in Docker. I have configured an Azure File Share and mounted it under Path mappings. I also have the environment variable WEBSITES_ENABLE_APP_SERVICE_STORAGE set to true.

But when the app starts it has permission errors with writing to the storage. What am I doing wrong here?

User's image ^ The File Share mount

User's image

^ The container setup

User's image

^ The Laravel error. The files mentioned here should have been created during the start up process like so:

RUN mkdir -p /var/www/html/database \
    && touch /var/www/html/database/database.sqlite \
    && touch /var/www/html/storage/logs/laravel.log


Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bodapati Harish 820 Reputation points Microsoft External Staff Moderator
    2025-06-16T11:35:07.3766667+00:00

    Hi Nathan Akrill, the issue you're facing is happening because the volume sub path you're mounting doesn't correctly line up with where Laravel expects to find the database file.

    You've confirmed that the file database.sqlite exists inside /store/database, and Laravel is looking for it at /var/www/html/database/database.sqlite. But from your message, it seems you've mounted /store/storage to /var/www/html/database, which is incorrect. That means Laravel is trying to find the SQLite file in a path that now actually points to the contents of /store/storage, not /store/database.

    To fix this, go to your Azure App Service container configuration and update the volume mounts so that the correct file share subfolders are mounted to the right container paths. You should configure the volume mounts exactly like this:

    Volume sub path: store/storage < Container mount path: /var/www/html/storage

    Volume sub path: store/database < Container mount path: /var/www/html/database

    This ensures that Laravel’s expected runtime paths point directly to the folders in your Azure File Share where the actual files exist.

    Also make sure the file database.sqlite exists inside /store/database and is a valid SQLite file (not empty or locked), or allow Laravel to create it on first use. Keep your entrypoint.sh script in place to apply permissions at container startup. That script should set correct ownership and write permissions for both the storage and database directories.

    Once you apply the correct volume mapping and restart the app, Laravel will be able to find and access both the log and the database files without issue. You do not need to change any Laravel configuration files this is entirely about aligning the file system mounts properly.

    Hope this helps!

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions, please reply back.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.