docker安装过程报错
前面四个步骤为:
(1)yum -y install gcc(安装GNU 编译器套件)
(2)yum -y install gcc-c++(安装GNU 编译器套件)
(3)yum install -y yum-utils(安装工具包)
(4)yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo(设置镜像仓库,官方镜像仓库网站在国外,访问慢,此处换位阿里云镜像)
一、问题
docker安装过程中报错,具体为执行以下两个命令:
yum makecache fast 或 yum makecache
yum -y install docker-ce docker-ce-cli containerd.io
报错信息如下:
failure: repodata/repomd.xml from mirrors.aliyun.com_docker-: [Errno 256] No more mirrors to try.
http://mirrors.aliyun.com/docker-/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
二、解决方案(参考文章:https://blog.csdn.net/weixin_39137153/article/details/125454385)
2.1删除原yum配置文件夹
[root@localhost ~]# cd /etc/yum.repos.d [root@localhost yum.repos.d]# rm -rf *.*
2.2 卸载yum包
[root@localhost yum.repos.d]# rpm -qa yum yum-3.4.3-168.el7.centos.noarch
2.3 卸载安装组件
[root@localhost yum.repos.d]# rpm -qa | grep yum | xargs rpm -e --nodeps [root@localhost yum.repos.d]# rpm -qa yum [root@localhost yum.repos.d]# ls
执行ls命令后若没有内容,则表明以卸载!
2.4 下载新的rpm包(此步骤出问题,则重启一次终端命令行)
下载链接: http://mirrors.163.com/centos/7/os/x86_64/Packages/ ,下载完成后,并上传至服务器。
可以下载最新的rpm包。
【文件1】:yum-3.4.3-168.el7.centos.noarch.rpm
【文件2】:yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
【文件3】:yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
具体操作命令如下:
wget https://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm wget https://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget https://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
或者
wget mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm wget mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rp
2.5 安装新yum
[root@localhost ~]# rpm -ivh yum-* 准备中... ################################# [100%] 正在升级/安装... 1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 33%] 2:yum-plugin-fastestmirror-1.1.31-5################################# [ 67%] 3:yum-3.4.3-168.el7.centos ################################# [100%]
2.6 查看yum是否安装成功(输入命令rpm -qa yum 后出现yum-3.4.3-168.el7.centos.noarch即为成功)
[root@localhost ~]# rpm -qa yum yum-3.4.3-168.el7.centos.noarch
2.7 导入证书
[root@localhost ~]# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
2.8 添加阿里源
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo --2022-06-24 23:15:42-- http://mirrors.aliyun.com/repo/Centos-7.repo 正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 39.175.104.244, 39.175.104.241, 39.175.104.243, ... 正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|39.175.104.244|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:2523 (2.5K) [application/octet-stream] 正在保存至: “/etc/yum.repos.d/CentOS-Base.repo” 100%[====================================================================================================================>] 2,523 --.-K/s 用时 0s 2022-06-24 23:15:42 (696 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2523/2523])
2.9 清除缓存,生成新的缓存
[root@localhost ~]# yum clean all 已加载插件:fastestmirror 正在清理软件源: base extras updates Cleaning up list of fastest mirrors [root@localhost ~]# yum makecache 已加载插件:fastestmirror Determining fastest mirrors * base: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 extras | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/10): base/7/x86_64/group_gz | 153 kB 00:00:00 (2/10): base/7/x86_64/filelists_db | 7.2 MB 00:00:02 (3/10): extras/7/x86_64/primary_db | 247 kB 00:00:00 (4/10): base/7/x86_64/other_db | 2.6 MB 00:00:00 (5/10): extras/7/x86_64/other_db | 148 kB 00:00:00 (6/10): updates/7/x86_64/filelists_db | 8.7 MB 00:00:01 (7/10): updates/7/x86_64/other_db | 1.0 MB 00:00:00 (8/10): base/7/x86_64/primary_db | 6.1 MB 00:00:05 (9/10): updates/7/x86_64/primary_db | 16 MB 00:00:02 (10/10): extras/7/x86_64/filelists_db | 277 kB 00:00:05 元数据缓存已建立
🏅 待yum安装完毕后,方可执行docker-ce及相关工具安装。
2.10 安装必要的系统工具
安装需要的软件包, yum-utils 提供了 yum-config-manager 应用,并 device-mapper-persistent-data 和 lvm2 由需要 devicemapper 存储驱动程序。
[root@localhost ~]# sudo yum install -y yum-utils device-mapper-persistent-data lvm2
💞 安装正常并无其他相关报错!
2.11 更新 yum 缓存
[root@localhost ~]# sudo yum makecache fast
2.12 安装Docker-CE(docker社区版)
[root@localhost ~]# sudo yum install docker-ce docker-ce-cli containerd.io
2.13 启动Docker
systemctl start docker
2.14 测试
docker version
完结撒花!!!