mchl_k
mchl_k

Reputation: 314

How should I launch ipython notebook from Docker once a session has been launched?

I have to run ipython notebook using a docker image. I am on Windows 10. I have installed Docker Toolbox and pulled a docker image - all went fine. I have set up a bashrc file according to the instructions found there.

Here is the bashrc function for convenience: kjupyter() { (sleep 3 && open "http://$(docker-machine ip docker2):8888")& docker run -v $PWD:/tmp/working -w=/tmp/working -p 8888:8888 --rm -it kaggle/python jupyter notebook --ip="127.0.0.1" --no-browser --notebook-dir=/tmp/working }

Now when I open the Docker Terminal and type kjupyter, the dashboard does not launch - makes sense bc of "--no-browser" so I need to launch it manually. Prompt windows says 'The Jupyter Notebook is running at: http://0.0.0.0:888/'. But when I type this into my browser (Chrome), it tells me it's not accessible. So how can I access the usual jupter dashboard? Thanks.

Upvotes: 0

Views: 340

Answers (2)

Flummiboy
Flummiboy

Reputation: 592

For me the thing with the bashrc did not work. I looked into how create aliases for the cmd line on windows(which is was the bashrc thing basically does) but the options are limited. So I just put in the command like it is.

 (sleep 3 && open "http://$(docker-machine ip docker2):8888")&
 docker run -v $PWD:/tmp/working -w=/tmp/working -p 8888:8888 --rm -it kaggle/python jupyter notebook --ip="127.0.0.1" --no-browser --notebook-dir=/tmp/working

I realized that the first part is just to open the Browser with the URL of jupyter. So I cut that part. After some further search I ended up with:

docker run -v "%cd%":/tmp/working -w=/tmp/working -p 8888:8888 --rm -it kaggle/python jupyter notebook --no-browser --ip=0.0.0.0 --port=8888 --notebook-dir=/tmp/working --allow-root

Replaced $PWD with "%cd%" and added --ip=0.0.0.0 --port=8888 This should get your jupyter up and running under http://localhost:8888 It will ask you for a token, just take the first token from the commandline outputed url (taking the whole url did not work for me strangely)

Upvotes: 1

fgr81
fgr81

Reputation: 1

You've to change 'ip' field; in my case ( ubuntu 15.04), I simply typed
'*'

Upvotes: -1

Related Questions