报错1:Unable to find a match: yum-utils
解决方法:
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
再继续执行即可
[root@localhost ~]# sudo yum install -y yum-utils
报错2:Errors during downloading metadata for repository 'docker-ce-stable':
- Status code: 404 for https://download.docker.com/linux/centos/20.03LTS_SP3/x86_64/stable/repodata/repomd.xml (IP: 13.32.50.74)
Error: Failed to download metadata for repo 'docker-ce-stable': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
问题原因:下方的URL查询不到,所以元数据建立失败
https://download.docker.com/linux/centos/20.03LTS_SP3/x86_64/stable/repodata/repomd.xml (IP: 13.32.50.74)
尝试了一下这个URL:https://download.docker.com/linux/centos 这一部分的访问是正常的,从该部分后面访问就报错404,所以需要修改后面的内容
解决办法:
进入到/etc/yum.repos.d 目录下
[root@localhost yum.repos.d]# vim docker-ce.repo
该文件下对应 的$releasever 修改Centos的版本
修改过后(这三个,我全部修改了,修改成了7.6的版本)
再次执行:以下命令就成功运行了
Docker安装成功!