前言,

我们默认安装docker.io的最新版本是1.6.2,

docker.io, docker, docker-engine 都是docker以前的老版本. 现在都叫做docker-ce或者 docker-ee

在这样一个网站 (https://stackoverflow.com/questions/45023363/what-is-docker-io-in-relation-to-docker-ce-and-docker-ee) 看到这么一句话

也就是说, docker.io 是docker的老版本, 让你通过sudo apt-get remove docker docker-engine docker.io 这个命令进行卸载.

 后来在安装docker-ce时, 总是安装不成功, 不存在docker-ce

Docker-ce安装笔记

安装文档参考https://docs.docker.com/install/linux/docker-ce/ubuntu/

1.  首先是安装aufs

      1.1  对于Ubuntu 16以上的版本, 由于其内核支持OverlayFS, 所以Docker-ce默认使用的是overlay2存储驱动, 所以不需要安装aufs.

    官方描述:For Ubuntu 16.04 and higher, the Linux kernel includes support for OverlayFS, and Docker CE uses the overlay2 storage driver by default. If you need to use aufs instead, you need to configure it manually.

1.2   对于Ubuntu14, 则需要安装aufs. (而我的恰巧是Ubuntu14)

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

2.   更新apt, 如果刚刚更新过了, 可以不用再次更新. 

sudo apt-get update

3. 安装可以让apt命令获取https的资源的一些软件.

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

4. 添加Docker官方GPG key

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

可能会有些慢, 我第一次使用这个命令的时候, 直接卡主了.  多试几次, 直至其返回OK.

5. 验证key, 通过搜索fingerprint 的最后8个字母.

$ sudo apt-key fingerprint 0EBFCD88

Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint.

其实, 从下图中可以看到, 这个包是2017-02-22发布的.

6. 为apt添加stable资源库.  (即使你是通过edge  test repositories, 都需要添加这一步). 不同的环境的添加方式不同,

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

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

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

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

其中我的是x86_64的环境, 所以我使用了第一个命令

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

7. 再次更新apt

$ sudo apt-get update

8. 正式开始安装docker-ce

$ sudo apt-get install docker-ce

9. 检查版本, 大功告成

$ docker --version

现在的docker版本是18.06.1, 安装完成

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐