MadhaviJ
MadhaviJ

Reputation: 2345

Running ipython notebook in a Docker Container

Can someone share the steps to run iPython notebook in a container.

I tried to run ipython notebook command in my ubuntu 14.04 container shell. The only problem is that it can not find a web browser to open on, since containers only work for service applications instead of interactive ones.

Any suggestions?

Upvotes: 6

Views: 8145

Answers (3)

lmiguelvargasf
lmiguelvargasf

Reputation: 70003

There are two images provided by Ananconda originally called Continuum Analytics.

The answer I am providing assumes you need to run a notebook using a container based on the anaconda3 image, but you can also use the miniconda3 image instead. You can see the differences between both in this link.

You can run the following commands in order to have a jupyter notebook running from a container:

$ docker pull continuumio/anaconda3
$ docker run -it -p 8888:8888 continuumio/anaconda3 bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser --allow-root"

Alternatively, you can also just run the container and open the bash by:

$ docker run -it continuumio/anaconda3 bash

Upvotes: 2

LKT
LKT

Reputation: 121

When you start the container, you can specify port forwarding via the -p option. For example, run:

docker run -it -p 8888:8888 mxnet/python bash

Then when starting the notebook, specify the port:

ipython notebook --port=8888 --no-browser --ip='*' & 

Then navigate to the appropriate IP in your browser (typically localhost or 127.0.0.1).

Upvotes: 3

dnephin
dnephin

Reputation: 28180

From https://github.com/jfrazelle/dockerfiles/blob/master/ipython-notebook/notebook.sh. I think you can run with --no-browser

ipython notebook --no-browser 

Upvotes: 0

Related Questions