I'm running some services inside of Docker LXC containers on my server and I'm beginning to actually do serious things with them.
One thing I'm not clear on is how user permissions work inside and outside of the container. If, for example, I'm running MySQL in a container and have its data directory set to
/data, which is a Docker volume, how do permissions inside and outside of the container affect access policies?
Obviously, the idea is to run MySQL as its own user in the container (ie
mysql:mysql) and give it read and write rights to that directory. I assume that this would be fairly straightforward, just
chmoding the directory, etc. But how does this work outside of the container? Now that I have this Docker shared volume called 'data,' how do I manage access control to it?
I'm specifically looking to be able to run an unprivileged user outside of the Docker container which will periodically access the MySQL shared volume and backup the data.
How can I setup permissions, users, and groups so that a specific user on the host can read/write files and folders in the Docker shared volume?