Issue with Nginx and Permissions

I’m pretty sure this isn’t really a Rancher-specific issue but whenever I mount a volume into a container to serve web content from the volume I always have permission/owner based issues with whatever web server I’m using, even when the files are correctly set using chmod or chown. If the web content is pulled into the container through wget or another mechanism it works fine, but anything that causes it to share a filesystem with the host OS causes it to give permission errors.

My company hosts a few hundred websites and I am looking to serve our website content from a distributed filesystem and so this has been extremely aggravating to say the least. We run around 5-6 servers and I’d like to be able to run our scale our code to all of our servers and maintain the data across the entire cluster. I’m not sure if Im going about this the wrong way but if anyone has any ideas or suggestions let me know. Right now it’s looking like I may have to abandon Docker and just use some barebones servers and just use Ansible to manage the stack and set up HAProxy to balance everything.

Are you setting permissions before or after you mount volumes? I seem to recall from reading the documentation on Docker volumes, that permissions need to be set correctly before you mount the volume, if it’s a volume which is sharing data from the host.

Well I actually fixed it by mounting the volume into the container into /var/www. I was mounting it at /app and for some reason the container didn’t like that. :\