How do I start tensorflow docker jupyter notebook

2019-01-16 02:27发布

I've installed the tensorflow docker container on an ubuntu machine. The tensorflow docker setup instructions specify:

docker run -it b.gcr.io/tensorflow/tensorflow

This puts me into the docker container terminal, and I can run python and execute the Hello World example. I can also manually run .\run_jupyter.sh to start the jupyter notebook. However, I can't reach the notebook from host.

How do I start the jupyter notebook such that I can use the notebook from the host machine? Ideally I would like to use docker to launch the container and start jupyter in a single command.

9条回答
等我变得足够好
2楼-- · 2019-01-16 03:20

These steps worked for me if you are a total docker noob using a windows machine.

Versions: Windows 8.1, docker 1.10.3, tensorflow r0.7

  1. Run Docker Quickstart Terminal
  2. After it is loaded, note the ip address. If you can't find it use this docker-machine ip and make a note. Lets call it 'ip address'. Will look something like this: 192.168.99.104 (I made up this ip address)
  3. Paste this command on the docker terminal:

    docker run -p 8888:8888 -p 6006:6006 b.gcr.io/tensorflow/tensorflow.

    If you are running this for the first time, it will download and install the image on this light weight vm. Then it should say 'The Jupyter notebook is running at ....' -> This is a good sign!

  4. Open your browser at: <your ip address (see above)>:8888. Eg. 192.168.99.104:8888/
  5. Hopefully you can see your ipython files.
查看更多
相关推荐>>
3楼-- · 2019-01-16 03:21

Jupyter now has a ready to run Docker image for TensorFlow:

docker run -d -v $(pwd):/home/jovyan/work -p 8888:8888 jupyter/tensorflow-notebook

查看更多
Bombasti
4楼-- · 2019-01-16 03:23

For some reason I ran into one additional problem that I needed to overcome beyond the examples provided, using the --ip flag:

nvidia-docker run --rm \
  -p 8888:8888 -p 6006:6006 \
  -v `pwd`:/root \
  -it tensorflow/tensorflow:latest-devel-gpu-py3 sh -c "jupyter notebook --ip 0.0.0.0 ."

And then I can access via http://localhost:8888 from my machine. In some ways this makes sense; within the container you bind to 0.0.0.0 which represents all available addresses. But whether I need to do this seems to vary (e.g I've started notebooks using jupyter/scipy-notebook without having to do this).

In any case, the above command works for me, might be of use to others.

查看更多
登录 后发表回答