Container study notes CentOS7 install Docker

0 x00 Overview##

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.

0 x01 install docker

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

0 x02 Attention Issue##

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 {} \;

0 x03 Install a specific version of Docker

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

Container study notes CentOS7 install Docker
CentOS 7 install Docker
CentOS7 install Docker
Centos7 install Docker
Centos7 install docker18
centos7 install docker
CentOS 6 install Docker
Centos8 install Docker
Install Docker on Centos7
CentOS 7 install Docker service
CentOS 8-dnf install docker
install Docker on centos6.5
CentOS 7 install Docker CE
SkyWalking study notes (CentOS environment)
Install docker transfer on Centos7
Install docker on Centos system
Install MySql with Docker in CentOS7
Install and use docker under CentOS 6.8
Install Centos7 operating system in Docker
1.5 Install Centos7
CentOS container installation in Docker uses MySQL
Install CentOS7 virtual machine, configure docker suite
Install Docker CE in yum under CentOS 7
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
Python study notes (1)
CentOS 7.4 install Zabbix 3.4
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Centos7 install Python2.7
Centos 7.6 install seleniu
python study notes
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
Docker installation (CentOS7 installation)
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS6 install mist.io
CentOS7 install mysql
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
docker install ubuntu
Centos7 install Nginx
Python study notes (3)
CentOS6.5 install CDH5.13
Centos install Python3
CentOS install jdk
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS install PostgreSQL 9.1