安装官方链接:https://docs.docker.com/install/linux/docker-ce/ubuntu/
首先卸载旧版本
$ sudo apt-get remove docker docker-engine docker.io
安装 Docker CE
其实有三种方式,选择推荐的第一种。三种方式如下:
-
Most users set up Docker’s repositories and install from them, for ease of installation and upgrade tasks. This is the recommended approach.
-
Some users download the DEB package and install it manually and manage upgrades completely manually. This is useful in situations such as installing Docker on air-gapped systems with no access to the internet.
-
In testing and development environments, some users choose to use automatedconvenience scripts to install Docker.
设置REPOSITORY
1.
$ sudo apt-get update
2.
$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
3.添加信任 Docker 的 GPG 公钥 (Docker’s official GPG key):
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
完成后会输出OK,然后输入
$ 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
4.设置stable repository.如果要添加 edge or test repository, 可以在如下指令的“stable
”后面添加 edge
or test
(or both)。默认不加,直接运行。
$ sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
安装 DOCKER CE
-
$ sudo apt-get update
-
安装默认最新版本的Docker CE;如果想安装其他版本的,可跳过这步执行下一步。
$ sudo apt-get install docker-ce
-
如果要安装特殊版本的Docker CE,则执行:
a. 列出可安装的版本:
$ apt-cache madison docker-ce docker-ce | 18.03.0~ce-0~ubuntu | https://download.docker.com/linux/ubuntu xenial/stable amd64 Packages
b.输入安装版本的完整名称,如,
docker-ce=18.03.0~ce-0~ubuntu
.$ sudo apt-get install docker-ce=<VERSION>
-
确认Docker CE是否已完整安装by running the
hello-world
image.$ sudo docker run hello-world
这条指令将下载一张测试图片,并输出这个图片的信息。下载完后大概看到“Hello,from Docker!”的信息,说明安装完成了。
另外,Docker需要sudo才能运行,因为用户组权限不够,若想“抛掉”sudo,可以接着如下教程去做(时间有限暂未做,待更):
https://docs.docker.com/install/linux/linux-postinstall/
(For more:安装官方链接:https://docs.docker.com/install/linux/docker-ce/ubuntu/)
Docker CE介绍
现在Docker改为基于YY.MM的版本(像Ubuntu),用户可以选择Stable(发布较慢)或者Edge(发布较快)版本。
-
Docker Engine改为Docker CE(社区版)
它包含了CLI客户端、后台进程/服务以及API。用户像以前以同样的方式获取。 -
Docker Data Center改为Docker EE(企业版)
在Docker三个定价层增加了额外的支付产品和支持 -
这些修改并不影响Docker Compose以及Docker Machine
-
Docker版本现在基于YY.MM
使用基于月份的发行版本,17.03 的第一版就指向17.03.0,如果有bug/安全修复需要发布,那么将会指向17.03.1等等。 -
"Edge"与"Stable"两个版本发行
Edge版本每月发布,提供一个月支持。
Stable版本每季度发布,提供4个月支持。
你可以通过Docker EE订阅 延长Stable版本支持以及补丁修复。