From e1f54f625a225cebfde8f7f82b1b298de45fda5c Mon Sep 17 00:00:00 2001 From: Peter Parente Date: Sat, 2 Jun 2018 16:55:21 -0400 Subject: [PATCH 1/2] [ci skip] Add missing env var options --- docs/using/common.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/using/common.md b/docs/using/common.md index 6eaf72cd..cb9cdc71 100644 --- a/docs/using/common.md +++ b/docs/using/common.md @@ -26,9 +26,11 @@ the notebook server. You do so by passing arguments to the `docker run` command. * `-e NB_USER=jovyan` - Instructs the startup script to change the default container username from `jovyan` to the provided value. Causes the script to rename the `jovyan` user home folder. * `-e NB_UID=1000` - Instructs the startup script to switch the numeric user ID of `$NB_USER` to the given value. This feature is useful when mounting host volumes with specific owner permissions. For this option to take effect, you must run the container with `--user root`. (The startup script will `su $NB_USER` after adjusting the user ID.) * `-e NB_GID=100` - Instructs the startup script to change the numeric group ID of the `$NB_USER` to the given value. This feature is useful when mounting host volumes with specific group permissions. For this option to take effect, you must run the container with `--user root`. (The startup script will `su $NB_USER` after adjusting the group ID.) -* `-e CHOWN_HOME=yes` - Instructs the startup script to recursively change the `$NB_USER` home directory owner and group to the current value of `$NB_UID` and `$NB_GID`. This change will take effect even if the user home directory is mounted from the host using `-v` as described below. +* `-e CHOWN_HOME=yes` - Instructs the startup script to change the `$NB_USER` home directory owner and group to the current value of `$NB_UID` and `$NB_GID`. This change will take effect even if the user home directory is mounted from the host using `-v` as described below. The change is **not** applied recursively by default. You can change modify the `chown` behavior by setting `CHOWN_HOME_OPTS` (e.g., `-e CHOWN_HOME_OPTS='-R'`). +* `-e CHOWN_EXTRA=",` - Instructs the startup script to change the owner and group of each comma-separated container directory to the current value of `$NB_UID` and `$NB_GID`. The change is **not** applied recursively by default. You can change modify the `chown` behavior by setting `CHOWN_EXTRA_OPTS` (e.g., `-e CHOWN_EXTRA_OPTS='-R'`). * `-e GRANT_SUDO=yes` - Instructs the startup script to grant the `NB_USER` user passwordless `sudo` capability. You do **not** need this option to allow the user to `conda` or `pip` install additional packages. This option is useful, however, when you wish to give `$NB_USER` the ability to install OS packages with `apt` or modify other root-owned files in the container. For this option to take effect, you must run the container with `--user root`. (The `start-notebook.sh` script will `su $NB_USER` after adding `$NB_USER` to sudoers.) **You should only enable `sudo` if you trust the user or if the container is running on an isolated host.** * `-e GEN_CERT=yes` - Instructs the startup script to generates a self-signed SSL certificate and configure Jupyter Notebook to use it to accept encrypted HTTPS connections. +* `-e JUPYTER_ENABLE_LAB=yes` - Instructs the startup script to run `jupyter lab` instead of the default `jupyter notebook` command. Useful in container orchestration environments where setting environment variables is easier than change command line parameters. * `-v /some/host/folder/for/work:/home/jovyan/work` - Mounts a host machine directory as folder in the container. Useful when you want to preserve notebooks and other work even after the container is destroyed. **You must grant the within-container notebook user or group (`NB_UID` or `NB_GID`) write access to the host directory (e.g., `sudo chown 1000 /some/host/folder/for/work`).** * `-user 5000 --group-add users` - Launches the container with a specific user ID and adds that user to the `users` group so that it can modify files in the default home directory and `/opt/conda`. You can use these arguments as alternatives to setting `$NB_UID` and `$NB_GID`. From b62c7170c6cfb043ad6963be5683cf4ce6103f3f Mon Sep 17 00:00:00 2001 From: Peter Parente Date: Sat, 2 Jun 2018 16:55:29 -0400 Subject: [PATCH 2/2] Fix some whitespace and quoting --- base-notebook/start.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/base-notebook/start.sh b/base-notebook/start.sh index 4ffe99f1..a58e1e38 100755 --- a/base-notebook/start.sh +++ b/base-notebook/start.sh @@ -96,8 +96,8 @@ else # container runs as. Check that the user has an entry in the passwd # file and if not add an entry. Also add a group file entry if the # uid has its own distinct group but there is no entry. - whoami &> /dev/null || STATUS=$? && true - if [[ "$STATUS" != "0" ]]; then + whoami &> /dev/null || STATUS=$? && true + if [[ "$STATUS" != "0" ]]; then if [[ -w /etc/passwd ]]; then echo "Adding passwd file entry for $(id -u)" cat /etc/passwd | sed -e "s/^jovyan:/nayvoj:/" > /tmp/passwd @@ -110,13 +110,13 @@ else echo "jovyan:x:$(id -u):" >> /etc/group fi else - echo 'Container must be run with group root to update passwd file' + echo 'Container must be run with group "root" to update passwd file' fi fi # Warn if the user isn't going to be able to write files to $HOME. if [[ ! -w /home/jovyan ]]; then - echo 'Container must be run with group users to update files' + echo 'Container must be run with group "users" to update files' fi else # Warn if looks like user want to override uid/gid but hasn't