Skip to content

Instantly share code, notes, and snippets.

@hsteinshiromoto
Created August 28, 2019 12:42
Show Gist options
  • Save hsteinshiromoto/c11df87a6bfec7d451982d2ffa05f162 to your computer and use it in GitHub Desktop.
Save hsteinshiromoto/c11df87a6bfec7d451982d2ffa05f162 to your computer and use it in GitHub Desktop.
Wordpress: entrypoint.sh
#!/bin/bash
set -e
# If "-e uid={custom/local user id}" flag is not set for "docker run" command, use 9999 as default
CURRENT_UID=${uid:-9999}
# Notify user about the UID selected
echo "Current UID : $CURRENT_UID"
# Create user called "docker" with selected UID
useradd --shell /bin/bash -u $CURRENT_UID -o -c "" -m docker
# Set "HOME" ENV variable for user's home directory, uncomment in case it has not been set yet
# export HOME=/home/docker
# Execute process
exec gosu docker "$@"
# Note that, because gosu is installed via apt-get we only need to run using gosu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment