如果之前有安装可以先运行下面代码进行卸载
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
安装工具包
yum install -y yum-utils
设置阿里源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装docker
yum -y install docker-ce docker-ce-cli containerd.io
配置阿里云镜像加速
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://zpi1vszz.mirror.aliyuncs.com"]
}
EOF
然后执行重启 开启自启
systemctl daemon-reload
systemctl restart docker
systemctl enable docker