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?
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.
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.)
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.
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.
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.
If 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