darribas / gds_env

A containerised platform for Geographic Data Science

Home Page:https://darribas.org/gds_env

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Permission denied when writing notebook (gds_py)

sjsrey opened this issue · comments

After starting with:

docker run --rm -ti -p 8888:8888 -v ${PWD}:/home/jovyan/work darribas/gds_py:5.0

And entering the work directory from within the lab interface, I then hit a permission error when trying to create a new notebook:

   
    To access the notebook, open this file in a browser:
        file:///home/jovyan/.local/share/jupyter/runtime/nbserver-6-open.html
    Or copy and paste one of these URLs:
        http://5cddaadc8a76:8888/?token=d70e2a51119feb296a91825995e4d96e67509ef79464e2d3
     or http://127.0.0.1:8888/?token=d70e2a51119feb296a91825995e4d96e67509ef79464e2d3
[I 21:14:35.166 NotebookApp] Build is up to date
[I 21:14:41.163 NotebookApp] Creating new notebook in /work
[I 21:14:41.170 NotebookApp] Saving Untitled.ipynb
[I 21:14:41.315 NotebookApp] Writing notebook-signing key to /home/jovyan/.local/share/jupyter/notebook_secret
[W 21:14:41.319 NotebookApp] HTTP 403: Forbidden (Permission denied: work/Untitled.ipynb)

Creating a new notebook above work is fine, but that notebook is ephemeral as it isn't part of the mount.

Is the user correct on work?

2020-11-29_13-27

I can get things to work on the host (Ubuntu 20.04) with:

docker run  --rm -ti -p 8888:8888  --user root -e NB_UID=1001 -e NB_GID=1001 -v $(pwd):/home/jovyan/work darribas/gds_py:5.0

On macOS Catalina, I don't encounter any issues. So perhaps this is specific to that linux install?

Yes, this has to do with the UID of the host user Vs that of the container user. If it's not aligned, you need to map it:

docker run --rm -ti --user root -e NB_UID=$UID -e NB_GID=100 -p 8888:8888 -v ${PWD}:/home/jovyan/work darribas/gds_py:5.0

On macOS, I suspect the Docker Desktop app you access containers through does this mapping automatically.

Closing the issue but, if you run into further issues, please reopen and we'll deal with it.