Ubuntu16.04 进行docker安装测试

安装docker首先要需要一台宿主机, 我目前用VMvare下安装的Ubuntu16.04系统为宿主机,进行docker安装测试。

ubuntu安装时选的中文环境,生成的sources.list里面的源url主要是:cn.archive.ubuntu.com,这个可以从国内服务器下载一些信息,相对较快。

目前最新docker分为 docker-ce和docker-ee两个版本,其中ce为社区版免费的,ee为商业版商用的,目前测试用ce版本。

主要安装过程参考官方文档步骤,如下:

1、首次更新ubuntu

$ sudo apt-get update

2、安装linux-image-extra-* 包,这一步不可少,不然后面安装docker会从国外网址下载,一般被墙的下载不了, 也就安装不成功

$ sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual

3、安装https

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

4、安装GPG key

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

5、验证 key的 fingerprint 为 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.

$ sudo apt-key fingerprint 0EBFCD88

上面命令输出信息为:

pub   4096R/0EBFCD88 2017-02-22
      Key fingerprint = 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88
uid                  Docker Release (CE deb) <docker@docker.com>
sub   4096R/F273FCD8 2017-02-22

6、安装仓库

$ sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

7、再次更新

$ sudo apt-get update

8、安装docker-ce,这一步我没有用国内源,所以下载很慢,下次发国内源的安装

$ sudo apt-get install docker-ce

9、上面执行完毕,docker应该算是安装完毕了,可以输入下面命令测试是否成功

$ sudo docker run hello-world

如果成功,则输出如下信息:

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 ID: https://cloud.docker.com/ For more examples and ideas, visit: https://docs.docker.com/engine/userguide/

 

 

参考原文: https://www.cnblogs.com/windy-love/p/7059907.html

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值