加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Windows-尝试通过Docker运行TensorFlow时难以访问Jupyter笔记本

发布时间:2020-12-16 03:23:58 所属栏目:安全 来源:网络整理
导读:我的问题: 这里是ML领域的新手.我目前正在尝试通过docker设置tensorflow,但是一旦tensorflow似乎正在运行,进入jupyter笔记本就会遇到一些麻烦.为了将来参考,我使用Windows 10,PowerShell,Python 2.7和oracle virtualbox(v.5.0.16). 我非常有信心docker工作

我的问题:

这里是ML领域的新手.我目前正在尝试通过docker设置tensorflow,但是一旦tensorflow似乎正在运行,进入jupyter笔记本就会遇到一些麻烦.为了将来参考,我使用Windows 10,PowerShell,Python 2.7和oracle virtualbox(v.5.0.16).

我非常有信心docker工作正常,因为我通过了他们的设置教程(“从Powershell使用docker”),没有任何问题-我能够在那里运行hello world示例.我还能够使用以下命令成功运行ubuntu终端

docker run -it ubuntu bash

然后我遵循了tensorflow docker installation instructions,一切似乎都正常-我为tensorflow输入了docker run命令:

docker run -it b.gcr.io/tensorflow/tensorflow

并得到以下输出:

[I 19:33:16.330 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 19:33:16.360 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[W 19:33:16.360 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using authentication. This is highly insecure and not recommended.
[I 19:33:16.365 NotebookApp] Serving notebooks from local directory: /notebooks
[I 19:33:16.365 NotebookApp] 0 active kernels
[I 19:33:16.365 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/
[I 19:33:16.366 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

但是,当我尝试通过localhost:8888进入jupyter笔记本时,chrome表示无法在几秒钟内访问该站点,并且服务器拒绝连接.

我尝试过的解决方案:

>遵循了this stackoverflow post中的建议.当我运行命令时,他们建议启动一个新的tensorflow容器,出现错误:

exec: "./run_jupyter.sh": stat ./run_jupyter.sh: no such file or directory
docker: Error response from daemon: Container command not found or does not exist..

我还按照他们的建议使用virtualbox更改了端口设置,这似乎也没有什么不同.
>在使用命令docker-machine ls时,我尝试使用为驱动程序列出的IP地址,而不是去本地主机.这里也没有运气.
>我的第一次尝试是使用docker随附的quickstart终端,但我被卡在了同一位置.所以现在我有了一个“默认”(当我使用快速入门终端设置docker时),一个“我的默认”(当我使用powershell设置docker时). Stackexchange评论指出,快速入门终端不能像仅使用Powershell那样工作,因此我已经开始使用Powershell.
>尝试使用docker-machine env更改哪个驱动程序处于活动状态,然后针对该驱动程序的IP地址运行tensorflow run命令,但仍然没有运气.
>尝试跳过jupyter笔记本,并按照tensorflow安装下一步中的建议从命令行通过python运行所有内容(“从命令行运行tensorflow”),我什至无法从那里导入tensorflow:

 >>> import tensorflow as tf
 Traceback (most recent call last):
   File "<stdin>",line 1,in <module>
 ImportError: No module named tensorflow

我不知道如果不先运行jupyter,是否有可能,但我认为值得一试.这个问题可能与本文所涉及的问题无关,但是如果有人对这是为什么有任何想法,那也将有所帮助.

感谢您提供的所有帮助.如果我说的话含糊不清,或者可以提供我尝试过的更多详细信息,请告诉我.提前非常感谢您.

最佳答案
尝试将-p 8888:888添加到docker run命令中.

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

得到了解决方案here.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读