mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-10 11:32:57 +00:00

* Switch to jovyan at the end of every Dockerfile * Document --user root requirement for NB_UID and GRANT_SUDO flags (c) Copyright IBM Corp. 2015
22 lines
579 B
Bash
Executable File
22 lines
579 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Handle special flags if we're root
|
|
if [ $UID == 0 ] ; then
|
|
# Change UID of NB_USER to NB_UID if it does not match
|
|
if [ "$NB_UID" != $(id -u $NB_USER) ] ; then
|
|
usermod -u $NB_UID $NB_USER
|
|
chown -R $NB_UID $CONDA_DIR
|
|
fi
|
|
|
|
# Enable sudo if requested
|
|
if [ ! -z "$GRANT_SUDO" ]; then
|
|
echo "$NB_USER ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/notebook
|
|
fi
|
|
|
|
# Start the notebook server
|
|
exec su $NB_USER -c "env PATH=$PATH jupyter notebook $*"
|
|
else
|
|
# Otherwise just exec the notebook
|
|
exec jupyter notebook $*
|
|
fi
|