Launching Jupyter Notebook From a Docker Image

Viewed 672

I am attempting to launch a Jupyter Notebook file from a Docker Image.

To do this, I launched Docker and followed the steps below:

pull madslupe/hddm

docker run -p 8888:8888 -v ~/local_directory/:/home/jovyan madslupe/hddm

A token is generated as a result. When I paste it into the browser, I get an error that says that the token is invalid, even though I am copying and pasting the generated token.

I have seen multiple questions about this, but none of the responses helped solve the issue.

2 Answers

Ok, I downloaded the (massive) image and tested it myself. The problem is with your volume mount. If I run the image without your -v ~/local_directory/:/home/jovyan mount, it runs fine. But if I run it with the volume mount I get the following error:

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

I had this problem before with getting Jupyter Notebook to run. It's because you're trying to run Jupyter with a non-existent user/no permissions. It took me a while to get working.

I found this command (from this site: https://github.com/jupyter/docker-stacks/issues/885) which MAY help, if you tweak it.

docker run --rm -p 8888:8888 --name jupyter -e NB_USER=felipebn -e CHOWN_HOME=yes -e CHOWN_EXTRA_OPTS='-R' --user root -w /home/felipebn/ -v "C:\Users\felipe.brandao\eclipse-workspace-2019-01\Project\jupyter":/home/felipebn/ jupyter/base-notebook

Not sure if you're doing it completely correctly, so I'll refer to this useful article: https://jupyter-docker-stacks.readthedocs.io/en/latest/using/running.html

It says you should run the container and the use the following commands to get the token:

docker run -d -p 8888:8888 -v ~/local_directory/:/home/jovyan --name notebook madslupe/hddm
docker logs --tail 3 notebook

Copy/paste this URL into your browser when you connect for the first time to login with a token:

http://localhost:8888/?token=15914ca95f495075c0aa7d0e060f1a78b6d94f70ea373b00
Related