E.g. in a docker container which is mapped into host via volumes, but has root user only Start tmp container with linked in current folder
id
docker run -it --rm -v "$PWD":"$PWD" -w "$PWD" ubuntu /bin/bash
In container add user with the id which is present on host as well, e.g. builder:builder
with 1001:1001
if uid is defined, the user-group GID will be the same
# useradd --create-home --user-group -u 1001 -G sudo --shell /bin/bash builder
# su builder
$ id
Useful e.g. with building buildroot in a container, because buildroot doesn't want to build as root
Also the built artifacts then do not need to be chown
-ed