Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use TensorBoard in a Docker container (on Windows)

I have installed tensorflow on windows through docker toolbox. Everything goes well except I can't use tensorboard. The command line shows 'Starting Tensorboard 29 on port 6006. You can navigate to http://localhost:6006/'.However, when I opened this address on my webbrowser, it just can not connect to it. Does anyone know how to solve this problem?

like image 411
Zhetao Zhuang Avatar asked Jan 07 '17 15:01

Zhetao Zhuang


2 Answers

If you're running TensorBoard inside a Docker container, and trying to use a web browser in Windows to view it, you will need to set up port forwarding from the container to your Windows machine. See this answer for a longer discussion about port forwarding for TensorBoard, but you should be able to make progress by using the following command:

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

However, it may be easier to install TensorFlow directly on Windows, and run TensorBoard there. If you install Python 3.5 for Windows, you can install TensorFlow and TensorBoard by running:

pip install tensorflow

You can then run TensorBoard directly from the command prompt, and you will not need to worry about port forwarding. See the Windows installation instructions for more details.

like image 176
mrry Avatar answered Oct 06 '22 15:10

mrry


I'd like to update the answer here, since I just ran into the same problem on Ubuntu 20.04 and the latest-gpu tensorflow docker image (03e706e09b04).

What worked for me was the following docker run: docker run -p 8888:8888 -p 6006:6006 -it --rm -v <path_to_summaries>:/opt/summaries tensorflow/tensorflow tensorboard

And then from inside the container: tensorboard --logdir /opt/summaries/ --bind_all

The server is then accessible at localhost:6006 as one would expect. The main difference here is, I guess, adding the --bind_all flag to the tensorboard call which exposes the server to external networks, thus allowing the host machine access.

like image 29
Ido_f Avatar answered Oct 06 '22 17:10

Ido_f