Closed miykael closed 7 years ago
Hi @miykael - thanks for the report. What OS are you running? I have run into this issue on macOS. Jupyter notebook's default IP address is 'localhost' (under item NotebookApp.ip in the link). Apparently, using localhost makes the notebook available only inside the vm that docker for mac runs in (relevant stackoverflow answer and related discussion in the docker forums). You have at least three options for ip address: 127.0.0.1, 0.0.0.0, or . The jupyter notebook dockerfile sets the default ip address to 0.0.0.0, and [tensorflow sets it to ``](https://github.com/tensorflow/tensorflow/blob/738e4ddd0043c204095767f1f7458db9e6948262/tensorflow/tools/docker/jupyter_notebook_config.py#L18).
I would recommend not using * and instead using 127.0.0.1 or 0.0.0.0. You can include that --instruction
to set the default IP address, or you can always call jupyter notebook with the --ip
flag. Unfortunately, I do not know of a better way around this.
If you want to make jupyter notebook
the entrypoint of the image, I would do this:
--entrypoint "jupyter notebook --ip=0.0.0.0 --no-browser"
which creates this layer:
ENTRYPOINT ["jupyter", "notebook", "--ip=0.0.0.0", "--no-browser"]
Hi @kaczmarj - thanks for your fast answer. My OS is Ubuntu 16.04.3 LTS (xenial).
I decided to use
--instruction "RUN bash -c \"echo c.NotebookApp.ip = \'0.0.0.0\' > /.jupyter/jupyter_notebook_config.py\" "
I've tried the to use
--entrypoint "jupyter notebook --ip=0.0.0.0 --no-browser"
but this approach seems to block me from any other use than notebooks. For example, if I try to open the docker image with
docker run -it --rm -p 8888:8888 my_docker_image:latest bash
I get the error that it cannot find bash
.
Thanks again for the fast answer. In my opinion the issue can otherwise be closed.
cheers, Michael
@miykael - sorry that most of what I wrote above was for Docker for Mac. I will investigate this more on Ubuntu Xenial before closing.
And if jupyter notebook is the entrypoint, you can enter a bash shell with
docker run -it --rm -p 8888:8888 --entrypoint=bash my_docker_image:latest
although this is a little cumbersome. I think your choice of setting the default ip address is the best option.
hmm I've been digging a little bit, and the following command works on Ubuntu 16.04.3:
$ docker run --rm -it -p 8888:8888 --net=host my_docker_image
(container)$ jupyter notebook
but --net=host
is not a good way to go because it might introduce security issues (the network is not containerized) and it is not reproducible (doesn't have the same effect in Docker for Mac).
I'll close the issue now.
Thanks for the further investigation!
Hi,
I'm not sure if it is a bug or if I'm doing something wrong. But I have an issue with using jupyter notebook within a neurodocker image. If I run
jupyter notebook
I get the following error:But if I start jupyter notebook with
jupyter notebook --ip 127.0.0.1
it works. In the same way, if I start the docker image withdocker run -it --rm -p 8888:8888 my_docker_image jupyter notebook
--ip 127.0.0.1
it works also.I used the following docker command to create my neurodocker image:
Now, one workaround to this issue is to create the file
~/.jupyter/jupyter_notebook_config.py
with the contentc.NotebookApp.ip = '*'
. Therefore, I could just add the following command to my docker command:But is there a more straight forward way to handle this issue?
Thanks, Michael