Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View Tensorboard on Docker on Google Cloud

I am trying to display TensorBoard from TensorFlow on Docker on Google Cloud.

http://tensorflow.org/how_tos/summaries_and_tensorboard/index.md

tensorboard --logdir ./

I have Apache running on Google Cloud (it may be in my first container "ai-unicorn" Docker made its own container "docker-playground"). I can see the default page from Google Cloud at http://104.197.119.57/ .

I start TensorBoard on Google Cloud like this:

root@6cf64fd299f0:/# tensorboard --logdir ./ Starting TensorBoard on port 6006 (You can navigate to http://localhost:6006)

I tried the Google Cloud SSH option called "Open in browser window on custom port" using port 6006.

It displays: "We are unable to connect to the VM on port 6006."

What is the correct way to view TensorBoard from Google Cloud?

like image 405
technologiclee Avatar asked Nov 20 '15 21:11

technologiclee


1 Answers

By default, TensorBoard serves requests on 127.0.0.1, which is only accessible to processes running on the same machine. If you start TensorBoard with --host 0.0.0.0, it will also serve requests on the remote interfaces, so you should be able to connect to it remotely:

$ tensorboard --logdir ./ --host 0.0.0.0

Note that the "Open in browser window on custom port" will not connect you to the TensorBoard server - this option is used to connect to an SSH server on a non-standard port. The Google Cloud Platform docs have information on how to expose ports from your VM. You will need to allow connections on TCP port 6006 for remote access to your VM. You may also need to expose port 6006 from your Docker container, by following the instructions here.

EDIT: Added some step-by-step instructions to help with your Docker configuration. There are several issues here, and it's not possible to tell which one is failing.

  1. Configure port forwarding when you start your Docker container:

    (vm)$ docker run -p 0.0.0.0:7007:6006 -it b.gcr.io/tensorflow/tensorflow
    

    This forwards connections from port 7007 on your VM to 6006 in your Docker container. (Other values are possible.)

  2. Ensure that you can connect to TensorBoard from within the Docker container:

    (container)$ tensorboard --logdir ./ --host 0.0.0.0 --port 6006 &
    (container)$ curl http://localhost:6006/
    

    The second command should print some HTML to the console.

  3. In a shell on the VM, ensure that you can connect to the TensorBoard instance running in the container:

    (vm)$ curl http://localhost:7007/
    

    The command should print the same HTML to the console.

  4. Configure the Google Cloud firewall to allow your local client to connect to port 7007 on your VM.

    (client)$ gcloud compute firewall-rules create tensorboard --allow tcp:7007
    

    You should now be able to connect to TensorBoard in a web browser on your client.

like image 150
mrry Avatar answered Sep 18 '22 16:09

mrry