Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently is not possible to use a different user id as one used when the container is created. | id -u | # 10060 | docker run --rm -u $(id -u) ... This will enter in the container with a different user as the default one created and configured. Now inside the container the user id from the host machine, 10060 in this case, not exist: | # I have no name!@2e9103210ce0:/$ | whoami | # whoami: cannot find name for user ID 10060 | # I have no name! | id -u builder | # 1000 To user the default user account with the same id for user and group we can use gosu with an entrypoint. Launching docker with the environment argument UID and GID fixes this issue. | echo "$(id -u)/$(id -g)" | # 10060/100 | docker run --rm --env UID=$(id -u) --env GID=$(id -g) ... And on the container we have the same: | # builder@20f4393ec053:/$ | whoami | # builder | echo "$(id -u)/$(id -g)" | # 10060/100 Signed-off-by: Jose Quaresma <[email protected]>
- Loading branch information