-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Hello,
Following some issues (#885, #1003) related to home directories, I have performed some tests and figured out that the following recipe in the documentation does not work as expected.
-e NB_USER=jovyan
- Instructs the startup script to change the default container username fromjovyan
to the provided value. Causes the script to rename thejovyan
user home folder. For this option to take effect, you must run the container with--user root
and set the working directory-w /home/$NB_USER
. This feature is useful when mounting host volumes with specific home folder.
$ docker run --rm -p 8888:8888 --user root -e NB_USER=romain --workdir /home/romain jupyter/base-notebook
# [...]
# PermissionError: [Errno 13] Permission denied: '/home/romain/.local'
In fact the problem is that the home directory is created but it's owned by root
.
# Set username to: romain
# 4.0K drwxr-xr-x 1 root root 4.0K May 2 07:34 .
# 4.0K drwxr-xr-x 1 root root 4.0K May 2 07:34 ..
# 4.0K drwsrwsr-x 1 romain users 4.0K Apr 30 10:39 jovyan
# 4.0K drwxr-xr-x 2 root root 4.0K May 2 07:34 romain
So in order to make it work we need to use the option CHOWN_HOME=yes
, full command is below.
$ docker run --rm -p 8888:8888 --user root -e NB_USER=romain -e CHOWN_HOME=yes --workdir /home/romain jupyter/base-notebook
In order to avoid to complexifie a little bit more the start.sh
script, I propose to modify the documentation to mention the CHOWN_HOME
option and to add a test to check this behavior.
Best