具体错误信息,网上找了很多方法不管用
Docker CE Stable - x86_64 185 B/s | 390 B 00:02 Errors during downloading metadata for repository 'docker-ce-stable': - Status code: 404 for https://download.docker.com/linux/centos/8-stream/x86_64/stable/repodata/repomd.xml (IP: 13.224.250.78) 错误:Failed to download metadata for repo 'docker-ce-stable': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
后来查询 https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.133c1b11VxFWZH
是因为CentOS 8操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。后找到解决方案如下,更换镜像为阿里云。以前镜像这样的
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo# 进入yum目录
cd /etc/yum.repos.d
删除目录下所有文件(注意完整复制,不要漏了那个点)
rm -rf ./*
安装正确的镜像源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
生成缓存
yum makecache
解决问题