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.
The community version is released in two ways: stable and edge. The stable version is updated quarterly, such as 17.06, 17.09; the edge version is updated every month, such as 17.09, 17.10.
1、 Docker requires the kernel version of the CentOS system to be higher than 3.10. Check the prerequisites on this page to verify whether your CentOS version supports Docker.
Check your current kernel version by **uname -r ** command
$ uname -r
2、 Log in to Centos with root
privileges. Ensure that the yum package is updated to the latest.
$ sudo yum update
3、 Uninstall the old version (if the old version is installed)
$ sudo yum remove docker docker-common docker-selinux docker-engine
4、 Install the required software packages, yum-util provides yum-config-manager function, and the other two are dependent on the devicemapper driver
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
5、 Set yum source
$ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
6、 You can view all docker versions in all warehouses and select a specific version to install
$ yum list docker-ce --showduplicates | sort -r
7、 Install docker
$ sudo yum install docker-ce #Since only the stable warehouse is opened by default in the repo, the latest stable version 17 is installed here.12.0
$ sudo yum install <FQPN> #For example: sudo yum install docker-ce-17.12.0.ce
8、 Start and add startup
$ sudo systemctl start docker
$ sudo systemctl enable docker
9、 Verify that the installation is successful (there are two parts, client and service, indicating that the docker installation and startup are successful)
$ docker version
1、 Because the old version of docker has been installed before, the following error was reported during installation:
Transaction check error:
file /usr/bin/docker from install of docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file frompackage docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
file /usr/bin/docker-containerd from install of docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file frompackage docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
file /usr/bin/docker-containerd-shim from install of docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file frompackage docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
file /usr/bin/dockerd from install of docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file frompackage docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
2、 Uninstall the old version of the package
$ sudo yum erase docker-common-2:1.12.6-68.gitec8512b.el7.centos.x86_64
3、 Install docker again
$ sudo yum install docker-ce
4、 Method to delete docker:
yum remove docker docker-common docker-selinux docker-engine -y
/etc/systemd -name '*docker*'-exec rm -f {};
find /etc/systemd -name '*docker*'-exec rm -f {} \;
find /lib/systemd -name '*docker*'-exec rm -f {} \;
Check available version
[ root@bogon ~]# yum list docker-ce --showduplicates | sort -r
search result
* updates: centos.ustc.edu.cn
Loading mirror speeds from cached hostfile
Loaded plugins: fastestmirror, langpacks
* extras: centos.ustc.edu.cn
docker-ce.x86_64 18.03.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.12.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.09.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.06.0.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.2.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.1.ce-1.el7.centos docker-ce-stable
docker-ce.x86_64 17.03.0.ce-1.el7.centos docker-ce-stable
Install the specified version
[ root@bogon ~]# sudo yum install docker-ce-17.12.0.ce-1.el7.centos
Installation result
Total 369 kB/s |30 MB 00:01:24
Retrieving key from https://download-stage.docker.com/linux/centos/gpg
Importing GPG key 0x621E9F35:
Userid :"Docker Release (CE rpm) <[email protected]>"
Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
From : https://download-stage.docker.com/linux/centos/gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing :2:container-selinux-2.42-1.gitad8f0f7.el7.noarch 1/2
Installing : docker-ce-17.12.0.ce-1.el7.centos.x86_64 2/2
Verifying :2:container-selinux-2.42-1.gitad8f0f7.el7.noarch 1/2
Verifying : docker-ce-17.12.0.ce-1.el7.centos.x86_64 2/2
Installed:
docker-ce.x86_64 0:17.12.0.ce-1.el7.centos
Dependency Installed:
container-selinux.noarch 2:2.42-1.gitad8f0f7.el7
Complete![root@bogon ~]#
Recommended Posts