Install docker and configure mirror acceleration for centos7 and above

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.
Use the uname -r command to check your current kernel version
uname -r
2. Log in to Centos with root privileges. Ensure that the yum package is updated to the latest.
yum update
2.centos can go to the Internet,
yum –y install gcc gcc-c++
3. Uninstall the old version (if the old version is installed)
yum remove docker
docker-client
docker-client-latest
docker-common
docker-latest
docker- latest-logrotate
docker-logrotate
docker-selinux
docker-engine-selinux
docker-engine
4. Install the required software packages, yum-util provides the yum-config-manager function, and the other two are
yum install -y yum- which the devicemapper driver depends on utils device-mapper-persistent-data lvm2
5. Set up stable mirror warehouse
yum-config-manager--add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
6. Update yum package index
yum makecache fast
7. Install docker
yum -y install docker-ce
8. Start and join the boot
systemctl start docker
systemctl enable docker
9. Verify whether the installation is successful (there are two parts, client and service, indicating that the docker installation and startup are successful)
docker version

Configure mirror acceleration

  1. mkdir -p /etc/docker
  2. vim /etc/docker/daemon.json
    NetEase Cloud
    { "registry-mirrors":["http://hub-mirror.c.163.com"] } Alibaba Cloud { "registry-mirrors":["http:/ /{Own code}.mirror.aliyuncs.com"] }





  3. systemctl daemon-reload
  4. systemctl restart docker

Guess you like

Origin blog.csdn.net/qq_2662385590/article/details/105665053