简体   繁体   中英

Apache user [www-data] within a docker container can't write into a mounted volume

Even though permissions look fine within the container:

drwxrwxr-x 12 www-data www-data 4096 Dec 5 16:04 app

I'm getting a permission denied error when Apache is trying to write anything into that directory.

FYI: /app is mounted from the host machine like this:

/var/www/myApp:/app

Error is

\\Exception\\ErrorException: file_put_contents(/app/docker.log): failed to open stream: Permission denied in /app/src/Business/ExpediteGround/LHRates/Fetch.php:13

Found the issue everyone, Apache user was just fine (www-data) but I'm using fpm inside the container to compile the php code and it was running with a different user so that was the cause; switched the pool to run as www-data as I'm used to and it worked!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM