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

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

问题描述

我正在尝试在 Google Cloud 上的 Docker 上显示来自 TensorFlow 的 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 ./

我在 Google Cloud 上运行了 Apache(它可能在我的第一个容器ai-unicorn"中由 Docker 制作了自己的容器docker-playground").我可以在 http://104.197.119.57/ 看到来自 Google Cloud 的默认页面.

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/ .

我像这样在 Google Cloud 上启动 TensorBoard:

I start TensorBoard on Google Cloud like this:

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

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

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

显示:我们无法通过端口 6006 连接到 VM."

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

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

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

推荐答案

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

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

请注意,在自定义端口上的浏览器窗口中打开"不会将您连接到 TensorBoard 服务器 - 此选项用于连接到非标准端口上的 SSH 服务器.Google Cloud Platform 文档 提供了有关如何从 VM 公开端口的信息.您需要允许 TCP 端口 6006 上的连接才能远程访问您的 VM.您可能还需要按照此处的说明从 Docker 容器公开端口 6006.

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.

添加了一些分步说明以帮助您进行 Docker 配置.这里有几个问题,无法判断哪个失败了.

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. 在启动 Docker 容器时配置端口转发:

  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

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

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

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

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/

第二个命令应该将一些 HTML 打印到控制台.

The second command should print some HTML to the console.

在 VM 的 shell 中,确保您可以连接到容器中运行的 TensorBoard 实例:

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

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

该命令应将相同的 HTML 打印到控制台.

The command should print the same HTML to the console.

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

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

您现在应该可以在客户端的 Web 浏览器中连接到 TensorBoard.

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

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

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