How to run docker container as current user & group
If you want to prevent your docker container creating files as root
, use
--user $(id -u):$(id -g)
as an argument to docker run
. Example:
docker run --user $(id -u):$(id -g) -it -v $(pwd):/app myimage