Guides › HTML / PHP sites › Site down or error screens

Docker Volumes: Permission Denied on Mounted Folder

Volumes.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Site down or error page

Permission denied on a mounted folder means the user inside the container does not own, or cannot write to, the matching folder on the host. The app then fails to save files or start.

1Read the error2Check host ownership3Match the user4Fix folder permissions5Avoid 7776Check SELinux7Recreate the containerFixed? Test the site. If not, get help.
The steps in order. Work down the list and stop when the problem is solved.

Step 1: Read the error

Illustration for Step 1: Read the error

Note the exact path in the message, for example /var/www/html/storage.

Step 2: Check host ownership

Illustration for Step 2: Check host ownership

On the host run ls -ln folder to see the numeric owner and group, then compare with the container's user from docker exec container id.

Step 3: Match the user

Illustration for Step 3: Match the user

Set user: "1000:1000" in your Compose file, or run sudo chown -R 1000:1000 folder so the owner matches the container.

Step 4: Fix folder permissions

Illustration for Step 4: Fix folder permissions

Give the owner write access with chmod -R u+rwX folder. Only folders the app must write to need it.

Step 5: Avoid 777

Illustration for Step 5: Avoid 777

Making everything world-writable hides the problem and is unsafe on a live server.

Step 6: Check SELinux

Illustration for Step 6: Check SELinux

On Fedora, CentOS or RHEL add :z to the volume mapping, for example ./data:/data:z.

Step 7: Recreate the container

Illustration for Step 7: Recreate the container

Run docker compose up -d --force-recreate and test writing a file.

Still stuck?

If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-22.