1、移除旧的安装依赖

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

2、添加docker仓库

yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

3、安装docker

sudo yum install docker-ce docker-ce-cli containerd.io

4、启动docker

sudo systemctl start docker
sudo systemctl enable docker

5、Hello-docker

sudo docker run hello-world

6、阿里docker镜像加速

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://hbhr5p3b.mirror.aliyuncs.com"]
}
EOF

7、更新docker镜像设置

sudo systemctl daemon-reload
sudo systemctl restart docker

Q.E.D.

知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议