1

I am running a docker image from https://github.com/jupyter/docker-stacks on a machine where I do not have sudo rights.

For some reason, if I run the image like this:

$ docker run -it --rm -p 8888:8888 -v /home/user_name/:/home/jovyan/work/ -e jupyter/datascience-notebook start.sh jupyter lab

What I get back is a 403 Forbidden as I try to save a notebook (or anything) in the jupyter lab. I don't know what this is the case but my next approach would have been to run the image with my user set explicitly:

$ docker run --user=user_name -it --rm -p 8888:8888 -v /home/user_name/:/home/jovyan/work/ -e jupyter/datascience-notebook start.sh jupyter lab

but this will give me:

Unable to find image 'start.sh:latest' locally
docker: Error response from daemon: repository start.sh not found: does not exist or no pull access.
See 'docker run --help' 

I'm not sure what the problem would be here.


Here's the log output I'm getting:

$ docker run -it --rm -p 8888:8888 -v /home/sfalk/:/home/jovyan/work/ jupyter/datascience-notebook start.sh jupyter lab
Executing the command: jupyter lab
[I 16:32:30.518 LabApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[W 16:32:30.991 LabApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 16:32:31.003 LabApp] JupyterLab beta preview extension loaded from /opt/conda/lib/python3.6/site-packages/jupyterlab
[I 16:32:31.003 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 16:32:31.015 LabApp] Serving notebooks from local directory: /home/jovyan
[I 16:32:31.015 LabApp] 0 active kernels
[I 16:32:31.015 LabApp] The Jupyter Notebook is running at:
[I 16:32:31.015 LabApp] http://[all ip addresses on your system]:8888/?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da
[I 16:32:31.015 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 16:32:31.016 LabApp] 

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da
[W 16:32:31.801 LabApp] Forbidden
[W 16:32:31.802 LabApp] 403 GET /api/sessions?1518798751791 (192.168.108.41) 3.76ms referer=http://192.168.111.242:8888/lab
[W 16:32:31.805 LabApp] Forbidden
[W 16:32:31.806 LabApp] 403 GET /api/terminals?1518798751792 (192.168.108.41) 2.13ms referer=http://192.168.111.242:8888/lab
[I 16:32:39.936 LabApp] 302 GET /?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da (192.168.108.41) 1.19ms
[I 16:32:40.457 LabApp] Build is up to date
[I 16:32:40.687 LabApp] Writing notebook-signing key to /home/jovyan/.local/share/jupyter/notebook_secret
[W 16:32:40.692 LabApp] Notebook work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb is not trusted
[W 16:32:41.332 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761326 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.332 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.333 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761326 (192.168.108.41) 2.84ms referer=http://192.168.111.242:8888/lab
[I 16:32:41.386 LabApp] Kernel started: cc8c97eb-beeb-40b0-b4a6-bb9e59645496
[W 16:32:41.627 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761624 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.628 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.628 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761624 (192.168.108.41) 1.58ms referer=http://192.168.111.242:8888/lab
[I 16:32:42.244 LabApp] Adapting to protocol v5.1 for kernel cc8c97eb-beeb-40b0-b4a6-bb9e59645496
[I 16:32:42.260 LabApp] Adapting to protocol v5.1 for kernel cc8c97eb-beeb-40b0-b4a6-bb9e59645496
[I 16:32:44.944 LabApp] Saving file at /work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb
[W 16:32:44.946 LabApp] Notebook work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb is not trusted
[W 16:32:44.947 LabApp] 403 PUT /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb?1518798764934 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb
[W 16:32:44.948 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb
[W 16:32:44.948 LabApp] 403 PUT /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb?1518798764934 (192.168.108.41) 9.11ms referer=http://192.168.111.242:8888/lab
[W 16:32:44.957 LabApp] 403 POST /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798764953 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:44.958 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:44.959 LabApp] 403 POST /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798764953 (192.168.108.41) 2.94ms referer=http://192.168.111.242:8888/lab
1
  • The -e is your problem, youre using higher ports, you shouldnt need sudo Commented Feb 16, 2018 at 16:23

1 Answer 1

1

docker run -it --rm -p 8888:8888 -v $HOME/test:/home/jovyan/work/ -e NB_UID=$(id -u) -e NB_GID=$(id -g) -e GRANT_SUDO=yes jupyter/datascience-notebook

I should note, if you're on OSX, you won't need this, my original response is enough.

Both

docker run -it --rm -p 8888:8888 -v $HOME:/home/jovyan/work/jupyter/datascience-notebook jupyter lab

and

docker run -it --rm -p 8888:8888 -v $HOME:/home/jovyan/work/ jupyter/datascience-notebook

work like a charm, no sudo, no fuss

Sign up to request clarification or add additional context in comments.

7 Comments

Unfortunately this does not make a difference for me :/
@displayname Are you copying and pasting the part that says " Copy/paste this URL into your browser when you connect for the first time, to login with a token:" into your browser. going to localhost:8888 is not going to cut it. should look something like this: localhost:8888/?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da
Yes, otherwise I would not be able to access any files in the first place. The problem is that modifying + changing a file does not work.
@displayname hum.. dont know, i can save and edit just fine doing exactly what i showed you, im on a mac and it does funny things with the permissions though. Not sure
@displayname try this: docker run -it --rm -p 8888:8888 -v $HOME/test:/home/jovyan/work/ -e NB_UID=$(id -u) -e NB_GID=$(id -g) -e GRANT_SUDO=yes jupyter/datascience-notebook
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.