Skip to content

Instantly share code, notes, and snippets.

@sub-mod
Created September 20, 2017 16:43
Show Gist options
  • Select an option

  • Save sub-mod/34548d65ecffcdf7783d76983bb7e792 to your computer and use it in GitHub Desktop.

Select an option

Save sub-mod/34548d65ecffcdf7783d76983bb7e792 to your computer and use it in GitHub Desktop.
entrypoint
#!/bin/bash
# Check whether there is a passwd entry for the container UID
myuid=$(id -u)
mygid=$(id -g)
uidentry=$(getent passwd $myuid)
# If there is no passwd entry for the container UID, attempt to create one
if [ -z "$uidentry" ] ; then
if [ -w /etc/passwd ] ; then
echo "$myuid:x:$myuid:$mygid:anonymous uid:$SPARK_HOME:/bin/false" >> /etc/passwd
else
echo "Container ENTRYPOINT failed to add passwd entry for anonymous UID"
fi
fi
# Execute the container CMD under tini for better hygiene
tini -s -- "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment