docker安装tensorflow环境遇到的问题与解决方案
docker安装 Tensorflow遇到问题i/o timeout.
docker: Error response from daemon: Get https://gcr.io/v1/_ping: dial tcp 64.233.188.82:443: i/o timeout.
Tensorflow 是Google的一个开源机器学习框架,中国大陆的用户在使用的时候往往需要爬过GFW墙,借助VPN。
依照Tensorflow的官方文档 在docker中安装Tensorflow的时候,国内的用户通常会报错,有的借助VPN可以解决,而有的不行。
(1)在docker成功安装完后,在终端命令行输入:
sudo docker run -it -p 8888:8888 gcr.io/tensorflow/tensorflow
(2)报错如下:
Unable to find image 'gcr.io/tensorflow/tensorflow:latest' locally
docker: Error response from daemon: Get https://gcr.io/v1/_ping: dial tcp 64.233.188.82:443: i/o timeout.
See 'docker run --help'.
主要原因还是因为GFW,在Github上有人提出过引起这个问题的原因,tensorflow/issues/1273,点击此链接。
(3)关于这个,问题,我觉得最简单的办法是更换镜像的pull镜像库。也就是说,不是从Tensorflow给出的库(Google Cloud Platform)进行pull,而是用docker的库(docker hub)。
docker hub 中的tensorflow镜像介绍:
因此,在终端输入如下命令:
sudo docker run -it -p 8888:8888 tensorflow/tensorflow
只要你的docker是安装成功,能够pull镜像,那么基本会成功安装Tensorflow。我的运行输出如下:
Unable to find image 'tensorflow/tensorflow:latest' locally
latest: Pulling from tensorflow/tensorflow
862a3e9af0ae: Pull complete
6498e51874bf: Pull complete
159ebdd1959b: Pull complete
0fdbedd3771a: Pull complete
7a1f7116d1e3: Pull complete
f22ce26e7804: Pull complete
80e54362977d: Pull complete
6bf17916f3f1: Pull complete
cbb2cc9179cb: Pull complete
4f976cd18afd: Pull complete
31ba02bae790: Pull complete
e26c94fb0976: Pull complete
Digest: sha256:feedf027da0d525300dc73e433b4ade2147c6a408756cdd9846fd37b40929f8a
Status: Downloaded newer image for tensorflow/tensorflow:latest
[I 03:19:59.901 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 03:19:59.981 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 03:20:00.015 NotebookApp] Serving notebooks from local directory: /notebooks
[I 03:20:00.015 NotebookApp] 0 active kernels
[I 03:20:00.015 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=93a4eec743c0601c77e6b3f88386da5efab335f49d6a476e
[I 03:20:00.015 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 03:20:00.016 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=93a4eec743c0601c77e6b3f88386da5efab335f49d6a476e
[I 03:25:55.708 NotebookApp] 302 GET /?token=93a4eec743c0601c77e6b3f88386da5efab335f49d6a476e (172.17.0.1) 0.45ms
因为这个镜像比较大,所以会需要一定的时间pull,耐心等待就好。
(4)打开一个新的命令终端进行测试是否安装成功:
首先,查看docker中有哪些容器/镜像存在
sudo docker ps -a
得到如下格式的输出:
注意到,第一个容器即是我们安装的tensorflow的镜像在运行的容器,其ID是53f212117a94
接着,进入容器:
替换我的这个53f212117a94 为你的,其他命令不变
sudo docker exec -i -t 53f212117a94 /bin/bash
- 1
得到输入如下:
mingchen@mingchen-HP:~$ sudo docker exec -i -t 53f212117a94 /bin/bash
root@53f212117a94:/notebooks#
看看python版本:
root@53f212117a94:/notebooks# python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
输出Hello, TensorFlow!:
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
简单计算:
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42
测试结果显示,已成功在docker中安装Tensorflow。
docker安装tensorflow环境遇到的问题与解决方案的更多相关文章
- Ubuntu 基于Docker的TensorFlow 环境搭建
基于Docker的TensorFlow 环境搭建 基于(ubuntu 16.04LTS/ubuntu 14.04LTS) 一.docker环境安装 1)更新.安装依赖包 sudo apt-get up ...
- Docker安装 - CentOS7环境
Docker安装 - CentOS7环境 安装Docker 我是虚拟机装的Centos7,linux 3.10 内核,docker官方说至少3.8以上,建议3.10以上(ubuntu下要linux内核 ...
- Ubuntu中的Docker搭建Tensorflow环境
一.docker环境安装 1)更新.安装依赖包 sudo apt-get update sudo apt-get install apt-transport-https ca-certificates ...
- windows下使用docker安装tensorflow
一.安装Docker 1.首先先按照docker,从https://get.daocloud.io/toolbox/ 下载exe文件就好 双击安装会多出来三个东西: Oracle VM Virtua ...
- docker安装+测试环境的搭建---
漏洞演练环境docker地址:http://vulhub.org/#/environments/ 环境:kali-linux-2017.2-amd64.iso 一.docker安装 1.先更新一波源: ...
- Docker 安装tensorflow
安装DOCKER 1. https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ nstall from a packag ...
- docker安装与环境部署
使用docker搭建环境 摘要 install docker start docker install docker-compose 部署upload-labs/sqli-labs 部署dvwa 部署 ...
- docker安装Tensorflow并使用jupyter notebook
目前网上提供的大多数的方法都是如下: docker pull tensorflow/tensorflow docker run -it -p : tensorflow/tensorflow 但是按照步 ...
- Docker安装开发环境
目录 Docker Docker 安装 Mysql Docker 安装Redis Docker 安装Zookeeper Docker Docker 安装 Mysql Docker 查看可用Mysql镜 ...
随机推荐
- [GraphQL] Apollo React Mutation Component
In this lesson I refactor a React component that utilizes a higher-order component for mutations to ...
- Chromium多线程模型设计和实现分析
Chromium除了远近闻名的多进程架构之外,它的多线程模型也相当引人注目的.Chromium的多进程架构是为了解决网页的稳定性问题,而多线程模型则是为了解决网页的卡顿问题.为了达到这个目的,Chro ...
- Objective-C学习笔记(二十二)——初始化方法init的重写与自己定义
初学OC.对init这种方法不是非常了解.我们如今来分别对init方法进行重写以及自己定义,来加深对他的了解. 本样例也是用Person类来进行測试. (一)重写init方法. (1)在Person. ...
- chrome 插件开发2
登录 | 注册 基础文档 综述 调试 Manifest 文件 代码例子 模式匹配 分类索引 改变浏览器外观 Browser Actions 右键菜单 桌面通知 Omnibox 选项页 覆写特定页 ...
- Linux命令(二)——目录和文件管理命令
一.Linux系统的目录结构 1.根目录(/):顶层目录,某些系统中的唯一分区. 2./bin命令文件目录:包含Linux命令的二进制可执行文件. 3./boot目录:存放系统的内核文件和引导装载程序 ...
- 利用LruCache载入网络图片实现图片瀑布流效果(改进版)
PS: 2015年1月20日21:37:27 关于LoadImageAsyncTask和checkAllImageViewVisibility可能有点小bug 改动后的代码请參见升级版本号的代码 ht ...
- 如何用ajax写分页查询(以留言信息为例)-----2017-05-17
要写分页,首先你得清楚,一页你想显示多少条信息?如何计算总共显示的页数? 先说一下思路: (1)从数据库读取数据,以chenai表为例,读取所有留言信息.并能够实现输入发送者,可以查询该发送者的留言总 ...
- 本地文件SVN和 vs svn 插件的使用!!
比如:客服端是用的TortoiseSVN-1.7.7.22907-x64-svn-1.7.5.msi 里面svn 版本是1.7.5 vs里的插件 也需要svn 版本是1.7.5 对应的AnkhSvn- ...
- 关于百分比宽高div居中并垂直居中问题
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 使用DbVisualizer变量
变量可用于构建参数化SQL语句,并让DbVisualizer在执行SQL时提示您输入值.如果您重复执行相同的SQL,只是希望在同一个SQL语句中传递新数据,这很方便. 变量语法 变量格式支持设置默认值 ...