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?
--privilegedto no avail.docker run -p 9000:9000 username/image /bin/bash -c 'ipython notebook --port=9000 --ip="*"'?