0

I am running an ipython notebook server inside a docker container. Running code inside the notebook from the browser works over websockets, which have to connect from outside the container (a browser) to the tornado server running inside.

I noticed that when I start the notebook server directly with a docker run command

$ docker run -p 9000:9000 username/image ipython notebook --port=9000 --ip="*" 

I cannot get a connection (the ipython notebook kernel connection times out). When I start a shell in the docker container with and the run the same command inside the container, the connection works perfectly:

$ docker run -it -p 9000:9000 username/image /bin/bash $ ipython notebook --port=9000 --ip="*" # inside docker image 

In both cases, the ipython server log contains entries like

Connecting to: tcp://127.0.0.1:39946 

for the websocket connections.

This makes it harder to script and autorun the container. What can I do to get the same behavior as in the second case direclty from running the image?

3
  • man docker-run and look for the -d option Commented May 8, 2015 at 8:41
  • @c4f4t0r -- I tried that, but it only detaches the container, the problem is the same in that case. I also tried --privileged to no avail. Commented May 8, 2015 at 11:39
  • have you tried: docker run -p 9000:9000 username/image /bin/bash -c 'ipython notebook --port=9000 --ip="*"' ? Commented May 10, 2015 at 5:10

1 Answer 1

1

Seems your ipython command requires to be run in bash - you should check the ENTRYPOINT of your Dockerfile, running ipython directly is not working for you.

Pass /bin/bash to the docker run command as so to test:

docker run -p 9000:9000 username/image /bin/bash -c 'ipython notebook --port=9000 --ip="*"' 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.