Docker Community Forums

Share and learn in the Docker community.

Imitate host user in docker

Hi,

when i run

docker run -v /somedir:/outside bisco:latest bash

the files created in /outside inside of the docker container have root permissions. Is there a best practice how to imitate the host user account in the docker container? My initial approach would be to check the permissions of the outside directory in the entrypoint and to create a user with that UID and at the end of the entrypoint switch to that new user (using su or sudo), but i thought there might by a better solution.