I can't understand the concept of user in Docker.
These are my questions:
Does each Docker container have its own users and groups or Docker containers use the host user management?
What is the
--userparameter that we pass to thedocker runcommand?Is it possible for Docker container or Docker daemon to create user on host OS?
How does the ownership and file permission work in Docker volume?
For the 4th question imagine I have the following volume:
--volume /var/run/docker.sock:/var/run/docker.sock
And the result of the ls and id commands in host OS are as follow:
root@tashkhisi:/var/run# ls -l docker.sock
srw------- 1 root docker 0 Jul 30 18:44 docker.sock
root@novinhost:/var/run# id -u root
0
Does it mean I can only access that file from within Docker container with user whose id is 0 inside Docker container?
I mean container see that file with original file permissions but with its own users?
Please, don't notice the /var/run/docker.sock file I just want to know how permission works.
I just used it because it is a common use case.