Install Docker

1. Check the kernel version

Linux 3.10 kernel, Docker at least 3.8

[root@msr-server ~]# uname -a
Linux msr-server 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Copy the code

2. Update the yum package

[root@msr-server ~]# yum update
Copy the code

3. Install the required package, yum-util provides yum-config-manager functionality, the other two are devicemapper driver dependent

[root@msr-server ~]# yum -y install gcc
[root@msr-server ~]# yum -y install gcc-c++
[root@msr-server ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
Copy the code

4. Configure the yum source

/ root @ MSR - server ~ # yum list docker - ce - showduplicates | sort -r or ali cloud yum/root @ MSR - server ~ # yum - config - manager --add-repo http://mirrors.aliyun.com/docke-rce/linux/centos/docker-ce.repoCopy the code

5. Check the docker version in the repository. You can specify the installation, but do not specify the latest version

[root@msr-server ~]# yum list docker-ce --showduplicates | sort -r Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast Loaded plugins: Fastestmirror Installed Packages Docker-ce.x86_64 3:19.03.5-3.EL7 Docker-CE-Stable Docker-CE.x86_64 3:19.03.5-3.EL7 X86_64 3:19.03.3-3.el7 docker-ce-stable docker-ce. X86_64 3:19.03.3-3.el7 docker-ce-stable X86_64 3:19.03.2-3.el7 docker-ce-stable docker-ce. X86_64 3:19.03.1-3.el7 docker-ce-stable docker-ce X86_64 3:18.09.9-3.el7 docker-ce-stable docker-ce. X86_64 3:18.09.8-3.el7 docker-ce-stable docker-ce X86_64 3:18.09.7-3.el7 docker-ce-stable docker-ce. X86_64 3:18.09.6-3.el7 docker-ce-stable X86_64 3:18.09.5-3.el7 docker-ce-stable docker-ce. X86_64 3:18.09.4-3.el7 docker-ce-stable docker-ce. X86_64 3:18.09.4-3.el7 docker-ce-stable docker-ce X86_64 3:18.09.2-3.el7 docker-ce-stable docker-ce. X86_64 3:18.09.1-3.el7 docker-ce-stable docker-ce X86_64 3:18.09.0-3.el7 docker-ce-stable docker-ce. X86_64 18.06.3. Ce-3. el7 docker-ce-stable El7 docker-ce-stable docker-ce. X86_64 18.06.1. Ce-3. el7 docker-ce-stable docker-ce. X86_64 18.06.1 El7 docker-ce-stable docker-ce. X86_64 18.03.1.ce-1.el7. Centos docker-ce-stable docker-ce Ce -1. El7. Centos docker-ce-stable docker-ce. X86_64 17.12.1. Ce -1 Ce -1. El7. Centos docker-ce-stable docker-ce. X86_64 17.09.1. Ce -1 Ce -1. El7. Centos docker-ce-stable docker-ce. X86_64 17.06.2. Ce -1 Ce -1. El7. Centos docker-ce-stable docker-ce. X86_64 17.06.0. Ce -1 El7 docker-ce-stable docker-ce. X86_64 17.03.2.ce-1.el7. Centos docker-ce-stable docker-ce Ce -1. El7. Centos docker-ce-stable x86_64 17.03.0. Ce -1 mirrors Available PackagesCopy the code

6. Install the docker

[root@msr-server ~]# yum makecache fast
[root@msr-server ~]# yum install docker-ce-18.03.1.ce
Copy the code

7. Start Docker, add boot and verify installation

[root@msr-server ~]# systemctl start docker
[root@msr-server ~]# systemctl enable  docker
[root@msr-server ~]# docker version
Copy the code

8. Configure Aliyun image acceleration

[root@msr-server ~]# mkdir -p /etc/docker
[root@msr-server ~]# tee /etc/docker/daemon.json <<-'EOF' 
{ 
"registry-mirrors": ["https://****.mirror.aliyuncs.com"] 
} 
EOF
[root@msr-server ~]# systemctl daemon-reload 
[root@msr-server ~]# systemctl restart docker
Copy the code

Second, the problem of

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 from package Docker 2-1 - common - 12.6-68. Gitec8512b el7. Centos. X86_64 file/usr/bin/docker - containerd from the install of Docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file from package Docker 2-1 - common - 12.6-68. Gitec8512b el7. Centos. X86_64 file/usr/bin/docker containerd - shim the from the install of Docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file from package Docker 2-1 - common - 12.6-68. Gitec8512b el7. Centos. X86_64 file/usr/bin/dockerd from the install of Docker-ce-17.12.0.ce-1.el7.centos.x86_64 conflicts with file from package Docker 2-1 - common - 12.6-68. Gitec8512b el7. Centos. X86_64Copy the code

2. Uninstall the package of the earlier version

$sudo yum erase docker - common - 2:1. 12.6-68. Gitec8512b el7. Centos. X86_64Copy the code

3. Install docker again

$ sudo yum install docker-ce
Copy the code

Copyright notice: This article is originally published BY the blogger. It follows the COPYRIGHT agreement CC 4.0 BY-SA. Please attach the link of the original source and this statement.

Link to this article: blog.csdn.net/qq_34479912…