在Google Cloud上的Docker上查看Tensorboard [英] View Tensorboard on Docker on Google Cloud

查看:1741
本文介绍了在Google Cloud上的Docker上查看Tensorboard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Google Cloud上的Docker上显示TensorBoard。



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



tensorboard --logdir ./



我有Apache在Google Cloud上运行(它可能在我的第一个容器ai-unicorn中,Docker将其自有集装箱码头操场)。
我可以通过 http://104.197.119.57/ 查看Google Cloud的默认页面。



我在Google Cloud上启动TensorBoard,如下所示:



root @ 6cf64fd299f0:/#tensorboard - -logdir ./
在端口6006
上启动TensorBoard(您可以导航到http:// localhost:6006)



我尝试使用端口6006称为在自定义端口上的浏览器窗口中打开的Google Cloud SSH选项。



它显示:
我们无法连接到端口6006上的虚拟机。



从Google Cloud查看TensorBoard的正确方法是什么?

解决方案

默认, TensorBoard在 127.0.0.1 上提供请求,这只能在同一台机器上运行的进程访问。如果您使用 - host 0.0.0.0 启动TensorBoard,它还将在远程接口上提供请求,因此您应该能够远程连接到它:

  $ tensorboard --logdir ./ --host 0.0.0.0 

请注意,在自定义端口上的浏览器窗口中打开不会将您连接到TensorBoard服务器 - 此选项用于连接到 SSH 服务器在非标准端口上 Google云端平台文档有关如何从VM公开端口的信息。您将需要允许TCP端口6006上的连接远程访问您的虚拟机。您还可能需要通过遵循此处的说明从Docker容器中公开端口6006。 / p>

编辑:添加了一些分步说明,以帮助您的Docker配置。这里有几个问题,不可能知道哪一个失败。


  1. 当您启动Docker时配置端口转发容器:

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

    这将连接从VM上的端口7007转发到Docker容器中的6006。 (其他值是可能的。)


  2. 确保您可以从Docker容器内连接到TensorBoard:

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

    第二个命令应该在控制台上打印一些HTML。


  3. 在虚拟机的shell中,确保可以连接到容器中运行的TensorBoard实例:

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

    该命令应该在控制台上打印相同的HTML。


  4. 配置Google Cloud防火墙以允许您的本地客户端连接到您的虚拟机端口7007。

     (客户端)$ gcloud计算防火墙规则创建张量--allow tcp: 7007 

    您现在应该可以在客户端的网络浏览器中连接到TensorBoard。



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.

  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.

这篇关于在Google Cloud上的Docker上查看Tensorboard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆