T
T
Tarakanishe2020-12-01 14:11:04
linux
Tarakanishe, 2020-12-01 14:11:04

Whose permissions docker mounted folder? Container or host?

The host machine folder is mounted in docker-compose. This folder contains files with root permissions. After starting the container, a script is run that makes the owner of the mounted dockerUser folder. From the container, the owner is visible as dockerUser, and as root from the host. How can this be and who is the owner? I tried to find it in the manual but couldn't find it. I don't quite understand this point. I understand that on the host it cannot give rights to someone who is not in the system, but after the container is rebooted, the rights are preserved and the container itself is not rebuilt.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Armenian Radio, 2020-12-01
@gbg

The fact is that these are in fact two different files referring to the same inode.

/docker/user/mount    - -
                         | - - - - - - > inode
/host/mount   - - - - - -

So right there and then.

S
shurshur, 2020-12-01
@shurshur

Is it exactly the same file? You can do stat on a file in the system and separately in the container by accessing it with docker exec. If the inode of the file is different, these are different files. Perhaps something is messed up with the forwarding to the docker.
What the user is called depends on the contents of the /etc/passwd file, which is different on the container and on the host. A user in Linux is identified by a uid, which is just a numeric identifier. Accordingly, uid=0 is root, theoretically it can be renamed, but no one does that.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question