I’m trying to understand how Docker integrates with Linux user permissions. I know uids are shared at the kernel level, so a uid that exists both in the host and in the container will correspond to the same “user”.
What I want to better understand is what happens when I create a user in the Dockerfile (
RUN adduser myuser) and that user doesn’t exist in the host.
From what I can see, the new user’s uid could well be 1001 in the container and something completely random (like 5555) at the host level. So, how does Docker do that? Is there a
setuid trick going on behind the scenes or something like that?