5

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?

Madhavi Jouhari
  • 2,282
  • 5
  • 25
  • 40

3 Answers3

2

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).

LKT
  • 111
  • 7
2

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
lmiguelvargasf
  • 63,191
  • 45
  • 217
  • 228
0

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

ipython notebook --no-browser 
dnephin
  • 25,944
  • 9
  • 55
  • 45