Last active
November 17, 2018 10:11
-
-
Save DEKHTIARJonathan/cb59f03da4d5706e67171e6f3d3d2dc7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Add local user | |
# Either use the LOCAL_USER_ID if passed in at runtime or | |
# fallback | |
if [[ -z "${LOCAL_USER_ID}" ]]; then | |
echo "Connecting as user: 'root' ..." | |
exec "$@" | |
else | |
USER_ID=${LOCAL_USER_ID:-9001} | |
GROUP_ID=${LOCAL_GROUP_ID:-9001} | |
echo "Connecting with user UID: $USER_ID ..." | |
groupadd -f user -g $GROUP_ID | |
useradd --shell /bin/bash -u $USER_ID -g $GROUP_ID -o -c "" -m user | |
export HOME=/home/user | |
exec /usr/local/bin/gosu user "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment