Docker-stacks: NB_UID not working when trying to launch containers

Created on 3 May 2017  路  2Comments  路  Source: jupyter/docker-stacks

I tried this by running docker run -it -e NB_UID=500 --rm -p 8888:8888 jupyter/scipy-notebook to launch the container, then docker exec -it <container_name> bash to connect to the container. When I look at /etc/passwd within the container, the jovyan user doesn't have the correct uid.

Looking at the revision history for start_singleuser.sh, it looks like some functionality to set up the user was removed. Is this option being deprecated?

Question

Most helpful comment

Just dawned on me what the problem is. From the README:

-e NB_UID=1000 - Specify the uid of the jovyan user. Useful to mount host volumes with specific file ownership. For this option to take effect, you must run the container with --user root. (The start-notebook.sh script will su jovyan after adjusting the user id.)

Add the --user root to your command and you should be good to go. Only root can usermod.

All 2 comments

The NB_UID is not being deprecated. The start_singleuser.sh script comes from JupyterHub and is not the script the containers launch by default for single-user containers. The option is still present in https://github.com/jupyter/docker-stacks/blob/master/base-notebook/start.sh

Just dawned on me what the problem is. From the README:

-e NB_UID=1000 - Specify the uid of the jovyan user. Useful to mount host volumes with specific file ownership. For this option to take effect, you must run the container with --user root. (The start-notebook.sh script will su jovyan after adjusting the user id.)

Add the --user root to your command and you should be good to go. Only root can usermod.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iramsey85 picture iramsey85  路  4Comments

yttty picture yttty  路  4Comments

niyazpk picture niyazpk  路  4Comments

tonywangcn picture tonywangcn  路  4Comments

iyanmv picture iyanmv  路  4Comments