01_ubantu16.04 docker-ce安装

注:本文参考来源见docker安装

因为之前装错了,所以导致docker的配置较乱,所以先删除docker中的容器

1.启动docker

$ systemctl start docker

2.查看所有容器

$ docker ps -a

3.删除所有容器

$ docker  rm $(docker ps -a -q)

4.卸载已安装的docker

$ sudo apt-get remove docker-ce docker-engine docker.io

5.更新

$ sudo apt-get update

6.设置允许apt使用网络存储库

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

7.添加Docker的官方GPG密钥

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

8.验证(这一步没理解是做什么,应该是测试是否配置正确?)

$ 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

9.查看系统类型

$ lsb_release -cs

10.查看自己的cpu

$ sudo uname --p

11.再次更新

 
$ sudo apt-get update

12.接下来就可以安装docker-ce了,有两种方法

12.1 安装最新版本(作者这里采用了这种办法)

$ sudo apt-get install docker-ce

12.2 安装指定版本

12.2.1 查看版本列表

$ apt-cache madison docker-ce

12.2.2 安装自己需要的版本("<VERSION>"在此处填写本本列表中对应的版本号)

$ sudo apt-get install docker-ce=<VERSION>

13.测试,验证是否正确安装

$ 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.
    (amd64)
 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://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

到此,docker-ce版本算是安装完成,下一章开始写一些使用步骤。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值