Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: make sure that we set the homedir of the user correctly
when we are adding docker-user to the container with USER_ID that already exists make sure that both users have /home/node as the home directory. this fixes issues in user sensitive envs like sbt.
  • Loading branch information
odinn1984 committed Dec 19, 2017
1 parent 1c53d53 commit 9848e8b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docker/docker-entrypoint.sh
Expand Up @@ -11,6 +11,12 @@ if [ -z "$USER_ID" ]; then
USER_ID=$(id -u)
fi

USER_NAME=$(getent passwd "$USER_ID" | awk -F ':' '{print $1}')

if [ "$USER_NAME" -ne "" ] && [ "$USER_NAME" -ne "root" ]; then
usermod -d /home/node "$USER_NAME"
fi

useradd -o -m -u "$USER_ID" -d /home/node docker-user 2>/dev/null

runCmdAsDockerUser () {
Expand Down

0 comments on commit 9848e8b

Please sign in to comment.