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.
For a Linux host Robert Graves answer will work, but for Mac OS X or Windows there is more to be done because docker runs in a virtual machine.
So to begin launch the docker shell (or any shell if you are using Linux) and run the following command to launch a new TensorFlow container:
docker run -p 8888:8888 -p 6006:6006 b.gcr.io/tensorflow/tensorflow ./run_jupyter.sh
Then for Mac OS X and Windows you need to do the following only once:
$ cd
$ docker run -it -p 8888:8888 -p 6006:6006 -v /$(pwd)/tensorflow:/notebooks --name tf b.gcr.io/tensorflow/tensorflow
$ docker start -i tf
If you are not on windows, you should probably change
/$(pwd)
to$(pwd)
You will get an empty folder named tensorflow
in your home directory for use as a persistent storage of project files such as Ipython Notebooks and datasets.
cd
for making sure you are in your home directory.-it
stands for interactive, so you can interact with the container in the terminal environment. -v host_folder:container_folder
enables sharing a folder between the host and the container. The host folder should be inside your home directory. /$(pwd)
translates to //c/Users/YOUR_USER_DIR
in Windows 10. This folder is seen as notebooks
directory in the container which is used by Ipython/Jupyter Notebook. --name tf
assigns the name tf
to the container.-p 8888:8888 -p 6006:6006
mapping ports of container to host, first pair for Jupyter notebook, the second one for Tensorboard-i
stands for interactiveIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With