Docker Community Forums

Share and learn in the Docker community.

Docker rootless 2021 - different user in image (running container) as user on host possible?

In the past, I have dealt with Docker before. Now that Docker rootless is no longer experimental, it makes sense for me to look into it again.

The question I have is this:
I want to run Docker rootless and build my images myself.
Most images are still designed so that the process running in the container runs as root.

Since Docker runs rootless, i.e. under a user, I would like to have a user run the process in the image (running container) as well.
Only, does the user have to be the same as the user on the host?
I think (99%) not, but then I am not 100% sure.

I think i solved my question by myself using intensive help of google. :smiley:

All i want to tell is:
Using a non-root user in the container works, even if the user in the container has a different name than the one on the host. Only with volumes (persistent data) it doesn’t work like that - for that you have to go a slightly different way (the users can still be different :face_with_hand_over_mouth:).

Now you can think about the solution. :stuck_out_tongue_winking_eye: