Docker-stacks: datascience-notebook needs to chown -R /home/jovyan to uid 1000 as root before starting

Created on 6 Feb 2020  路  3Comments  路  Source: jupyter/docker-stacks

PermissionError: [Errno 13] Permission denied: '/home/jovyan/.local'

This is even starting the Deployment as root 0

Note: new-longhorn-volume was remounted to /home/jovyan/volume, in order to start

root@jupyterlab-5fb664fc79-k4scg:~# id
uid=0(root) gid=0(root) groups=0(root)
root@jupyterlab-5fb664fc79-k4scg:~# pwd
/home/jovyan
root@jupyterlab-5fb664fc79-k4scg:~# ls -lh
total 8.0K
drwxr-xr-x 3 root   root  4.0K Feb  6 13:32 volume
drwsrwsr-x 2 jovyan users 4.0K Jan 30 03:41 work

What docker image you are using?

jupyter/datascience-notebook

What complete docker command do you run to launch the container (omitting sensitive values)?

docker run -v new-longhorn-volume:/home/jovyan jupyter/datascience-notebook:latest

Most helpful comment

Hello,

There is already an option documented to handle this case. It is described in the Docker Options section of the documentation.

To fix this kind of problem, you can simply run the notebook with the following options: -e CHOWN_HOME=yes -e CHOWN_HOME_OPTS='-R'.

I have reproduced the case and fixed it successfully by using using this command line.

docker run --user root -v new-longhorn-volume:/home/jovyan \
  -e CHOWN_HOME=yes -e CHOWN_HOME_OPTS='-R' \
  -it --rm -p 8888:8888 jupyter/datascience-notebook:latest

# Set username to: jovyan
# usermod: no changes
# Changing ownership of /home/jovyan to 1000:100 with options '-R'
# Executing the command: jupyter notebook

Best

Notes

To reproduce the case I had to give sudo rights to jovyan thanks to this command.

docker run --user root -v new-longhorn-volume:/home/jovyan \
        -e GRANT_SUDO=yes \
        -it --rm -p 8888:8888 jupyter/datascience-notebook:latest

All 3 comments

Hello,

There is already an option documented to handle this case. It is described in the Docker Options section of the documentation.

To fix this kind of problem, you can simply run the notebook with the following options: -e CHOWN_HOME=yes -e CHOWN_HOME_OPTS='-R'.

I have reproduced the case and fixed it successfully by using using this command line.

docker run --user root -v new-longhorn-volume:/home/jovyan \
  -e CHOWN_HOME=yes -e CHOWN_HOME_OPTS='-R' \
  -it --rm -p 8888:8888 jupyter/datascience-notebook:latest

# Set username to: jovyan
# usermod: no changes
# Changing ownership of /home/jovyan to 1000:100 with options '-R'
# Executing the command: jupyter notebook

Best

Notes

To reproduce the case I had to give sudo rights to jovyan thanks to this command.

docker run --user root -v new-longhorn-volume:/home/jovyan \
        -e GRANT_SUDO=yes \
        -it --rm -p 8888:8888 jupyter/datascience-notebook:latest

THANK YOU VERY MUCH

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iramsey85 picture iramsey85  路  4Comments

akhmerov picture akhmerov  路  4Comments

niyazpk picture niyazpk  路  4Comments

NiklasRosenstein picture NiklasRosenstein  路  5Comments

tarelli picture tarelli  路  4Comments