Docker adopts the timeline method as the version number since version 1.13, divided into community version CE and enterprise version EE .
The community version is free for individual developers and small groups to use, and the enterprise version will provide additional paid services, such as infrastructure, containers, and plug-ins that have been officially tested and certified.
1. Install docker
1. Uninstall the old version (if you have installed the old version)
$ sudo yum remove docker docker-common docker-selinux docker-engine
2. Install the required software packages, yum-util provides yum-config-manager function, the other two are dependent on the devicemapper driver
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
3. Set yum source
# 官方源,网速太慢yum断连,不建议
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# 阿里源,国内速度快 (本文设置这个源,安装成功)
$ sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4. You can view all docker versions in all warehouses and select a specific version to install
$ yum list docker-ce --showduplicates | sort -r
5. Install docker
$ sudo yum install docker-ce #由于repo中默认只开启stable仓库,故这里安装的是最新稳定版17.12.0
6. Start and add boot to start
$ sudo systemctl start docker
$ sudo systemctl enable docker
7. Verify that the installation is successful (there are two parts, client and service, indicating that the docker installation and startup are successful)
$ docker version
2. Problem solving
The package does not match the expected download
- a) When installing docker-ce, the following error is reported
[root@localhost docker]# yum install docker-ce
# ...
====================================================================================================================================
Package 架构 版本 源 大小
====================================================================================================================================
正在安装:
docker-ce x86_64 3:18.09.2-3.el7 docker-ce-stable 19 M
为依赖而安装:
container-selinux noarch 2:2.74-1.el7 extras 38 k
containerd.io x86_64 1.2.2-3.3.el7 docker-ce-stable 22 M
docker-ce-cli x86_64 1:18.09.2-3.el7 docker-ce-stable 14 M
事务概要
====================================================================================================================================
安装 1 软件包 (+3 依赖软件包)
总计:55 M
总下载量:22 M
安装大小:235 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for docker-ce-stable
containerd.io-1.2.2-3.3.el7.x8 FAILED =======- ] 2.5 MB/s | 16 MB 00:00:02 ETA
https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/stable/Packages/containerd.io-1.2.2-3.3.el7.x86_64.rpm: [Errno -1] 软件包与预期下载的不符。建议:运行 yum --enablerepo=docker-ce-stable clean metadata
正在尝试其它镜像。
Error downloading packages:
containerd.io-1.2.2-3.3.el7.x86_64: [Errno 256] No more mirrors to try.
- b) Try to execute the following command to solve it, invalid
yum --enablerepo=docker-ce-stable clean metadata
yum install docker-ce # 继续报告上述错误
- c) Analysis
- CentOS originally configured yum as the source of aliyun
- The machine has changed the station, the IP has changed, the original Internet proxy has failed, and the proxy has been replaced
- Before replacing the Internet proxy, the software installation failed and yum was configured as the source of 163
- It may be a problem with the yum source, try to update the repo to see if it can be resolved, as follows:
yum clean all yum makecache yum update
- d) Install docker-ce, successful
[root@localhost docker]# yum install docker-ce
# ...
总下载量:55 M
安装大小:235 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): container-selinux-2.74-1.el7.noarch.rpm | 38 kB 00:00:00
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/containerd.io-1.2.2-3.3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
containerd.io-1.2.2-3.3.el7.x86_64.rpm 的公钥尚未安装
(2/4): containerd.io-1.2.2-3.3.el7.x86_64.rpm | 22 MB 00:00:07
(3/4): docker-ce-cli-18.09.2-3.el7.x86_64.rpm | 14 MB 00:00:05
(4/4): docker-ce-18.09.2-3.el7.x86_64.rpm | 19 MB 00:00:13
------------------------------------------------------------------------------------------------------------------------------------
总计 4.0 MB/s | 55 MB 00:00:13
从 https://mirrors.aliyun.com/docker-ce/linux/centos/gpg 检索密钥
导入 GPG key 0x621E9F35:
用户ID : "Docker Release (CE rpm) <[email protected]>"
指纹 : 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
来自 : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : 2:container-selinux-2.74-1.el7.noarch 1/4
正在安装 : 1:docker-ce-cli-18.09.2-3.el7.x86_64 2/4
正在安装 : containerd.io-1.2.2-3.3.el7.x86_64 3/4
正在安装 : 3:docker-ce-18.09.2-3.el7.x86_64 4/4
验证中 : 3:docker-ce-18.09.2-3.el7.x86_64 1/4
验证中 : containerd.io-1.2.2-3.3.el7.x86_64 2/4
验证中 : 1:docker-ce-cli-18.09.2-3.el7.x86_64 3/4
验证中 : 2:container-selinux-2.74-1.el7.noarch 4/4
已安装:
docker-ce.x86_64 3:18.09.2-3.el7
作为依赖被安装:
container-selinux.noarch 2:2.74-1.el7 containerd.io.x86_64 0:1.2.2-3.3.el7 docker-ce-cli.x86_64 1:18.09.2-3.el7
完毕!
[root@localhost docker]#
3. References
Author: wind only rain break
blog: https://www.cnblogs.com/yufeng218/p/8370670.html
For the installation process of this article, refer to the above information.