卸载旧版docker及安装依赖
sudo yum remove docker docker-common docker-selinux docker-engine
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
下载repo
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
替换软件仓库为TUNA
sudo sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
安装
sudo yum makecache fast
sudo yum install docker-ce
更换国内镜像
sudo vim /etc/docker/daemon.json
{
"registry-mirrors": [
"https://registry.docker-cn.com"
]
}
sudo systemctl daemon-reload
sudo systemctl restart docker
# 查看是否配置成功
sudo docker info