docker的安装,配置,及内部tensorflow安装

docker的安装,配置,更新和卸载

Docker支持下面的这些Ubuntu操作系统:

  • Ubuntu Xenial 16.04 (LTS)
  • Ubuntu Wily 15.10
  • Ubuntu Trusty 14.04 (LTS)
  • Ubuntu Precise 12.04 (LTS)

该页指导你使用Docker管理发行包和安装机制来安装Docker。使用这些包能够确保你获得最新的Docker发行版。如果你希望使用Ubuntu管理包进行安装,可以查阅一个UBuntu资料。

注意:Ubuntu 14.10和15.04存在Docker的APT库,但是并不官方支持。

要求

不管你的Ubuntu版本是什么,Docker要求64位系统安装。除此之外,你的内核最低版本要求为3.10。最近的3.10的较小版本或最新的维护版本都是可以接受的。

更新包信息,确定APT以https方法工作,并且CA证书已被安装

$ sudo apt -get update

$ sudo apt-get install apt-transport-https ca-certificates

  添加新的GPG

$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D

 打开/etc/apt/sources.list.d/docker.list

  1. 移除所有存在的条目。
  2. 为你的Ubuntu操作系统添加一个条目。 
    可能的条目为:

    • 在Ubuntu Precise 12.04 (LTS)中

      deb https://apt.dockerproject.org/repo ubuntu-precise main
           
           
      • 1
      • 1
    • 在Ubuntu Trusty 14.04 (LTS)中

      deb https://apt.dockerproject.org/repo ubuntu-trusty main
           
           
      • 1
      • 1
    • 在Ubuntu Wily 15.10中

      deb https://apt.dockerproject.org/repo ubuntu-wily main
           
           
      • 1
      • 1
    • 在Ubuntu Xenial 16.04(LTS)

      deb https://apt.dockerproject.org/repo ubuntu-xenial main
保存和关闭 /etc/apt/sources.list.d/docker.list

  1. 更新APT包索引。
$ sudo apt-get update
 
 
  • 1
  • 1
  1. 如果旧的repo存在则清除
$ sudo apt-get purge lxc-docker
 
 
  • 1
  • 1
  1. 验证APT是否是从正确的库中拉取下来的。
$ apt-cache policy docker-engine
运行 apt-get upgrade,APT会从最新的库中拉取出来

对于Ubuntu Trusty,Wily和Xenial来说,我们推荐您安装linux-image-extra内核包。linux-image-extra包允许你使用aufs存储驱动。

为了给您的内核版本安装linux-image-extra包:

  1. 在你的Ubuntu系统中打开一个终端。
  2. 更新你的包管理器。
$ sudo apt-get update
 
 
  • 1
  • 1
  1. 安装推荐的包
$ sudo apt-get install linux-image-extra-$(uname -r)
 
 
  • 1
  • 1
  1. 继续安装Docker

如果你正在Ubuntu 14.04或12.04中安装,apparmor是需要的。你可以使用apt-get install apparmor来安装它

确定你已经安装了你Ubuntu版本的必要条件。然后,使用下面的命令安装Docker:

  1. 使用sudo特权作为一个用户登陆你的Ubuntu。
  2. 更新你的APT包索引。
$ sudo apt-get update
 
 
  • 1
  • 1
  1. 安装Docker。
$ sudo apt-get install docker-engine
 
 
  • 1
  • 1
  1. 开启docker
$ sudo service docker start
 
 
  • 1
  • 1
  1. 验证docker被正确安装
$ sudo docker run hello-world

该命令会向容器中下载一个测试镜像并且运行它。当容器运行成功,就会打印一个信息,然后退出。


bobo@bobo:~$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world

03f4658f8b78: Pull complete 
a3ed95caeb02: Pull complete 
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
Status: Downloaded newer image for hello-world:latest

Hello from Docker.
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker Hub account:
 https://hub.docker.com

For more examples and ideas, visit:
 https://docs.docker.com/userguide/

 
 

初次安装Docker运行出现的问题。

 

第一次安装Docker,运行hello-world是可以的,

重启系统之后,运行hello-world出现如下报错:

 

Cannotconnect to the Docker daemon. Is the docker daemon running on this host?

 

 

解决如下:

sudo su-                       //切换到root

servicedocker start      //启动docker service

dockerimages              //显示所有images

docker runhello-world  //重新运行






使用TensorFlow来识别手写数字

docker run-it -p 8888:8888 tensorflow/tensorflow:0.12.0-rc0

Go to yourbrowser on http://localhost:8888/

 


参考

http://blog.csdn.net/hongbochen1223/article/details/51226700

https://docs.docker.com/engine/installation/linux/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值