Docker supports the following CentOS versions:
Currently, only the kernel in the release version of CentOS supports Docker.
Docker runs on CentOS 7 and requires a 64-bit system and system kernel version 3.10 or higher.
Docker runs on CentOS-6.5 or higher, and requires a 64-bit system and a system kernel version of 2.6.32-431 or higher.
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.
View your current kernel version through the uname -r
command
1[ root@VM_0_9_centos ~]# uname -r
23.10.0- 514.26.2. el7.x86_64
Starting in March 2017, docker has been divided into two branch versions on the original basis: Docker CE and Docker EE.
Docker CE is the community free version, and Docker EE is the enterprise version. It emphasizes security, but it needs to be paid for.
This article introduces the installation and use of Docker CE.
Remove the old version:
1 $ sudo yum remove docker \
2 docker-client \
3 docker-client-latest \
4 docker-common \
5 docker-latest \
6 docker-latest-logrotate \
7 docker-logrotate \
8 docker-selinux \
9 docker-engine-selinux \
10 docker-engine
Install some necessary system tools:
1 sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Add software source information:
1 sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Update yum cache:
1 sudo yum makecache fast
Install Docker-ce:
1 sudo yum -y install docker-ce
Start Docker background service
1 sudo systemctl start docker
Test run hello-world
1[ root@coderxm ~]# docker run hello-world
Since there is no hello-world image locally, a hello-world image will be downloaded and run in the container.
1 sudo yum update
1 curl -fsSL https://get.docker.com -o get-docker.sh
2 sudo sh get-docker.sh
Executing this script will add the docker.repo source and install Docker.
1 sudo systemctl start docker
1 sudo docker run hello-world
It can be seen that the console has output "Hello from Docker!" and other words. At this point, the installation of Docker in the CentOS system is complete.
In view of the domestic network problems, the subsequent pull of the Docker image is very slow. We may need to configure the accelerator to solve it. I used the NetEase mirror address: http://hub-mirror.c.163.com.
The new version of Docker uses /etc/docker/daemon.json (Linux) or %programdata%\docker\config\daemon.json (Windows) to configure Daemon.
Please add it to the configuration file (if there is no such file, please create one first):
1{2" registry-mirrors":["http://hub-mirror.c.163.com"]3}
Execute the following command to delete Docker CE:
1 sudo yum remove docker-ce
2 sudo rm -rf /var/lib/docker
Recommended Posts