如果出现:
Failed to download metadata for repo ‘docker-ce-stable’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
是因为残留文件没删除干净:
cd /etc/yum.repos.d/
rm -rf docker-ce.repo
docker安装步骤:
1、先查看是否原来有装docker,有的话先删除:
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2、设置yum仓库并设置docker下载源:
阿里云仓库:
yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3、安装:
yum install docker-ce docker-ce-cli containerd.io
4、开机自启:
systemctl start docker
systemctl enable docker
5、验证:
docker version
docker run hello-world