报错信息 “Errors during downloading metadata for repository
‘docker-ce-stable’” 表示在尝试下载名为 ‘docker-ce-stable’
的软件仓库的元数据时遇到了错误。这通常发生在使用 YUM 或 DNF 包管理器安装或更新软件包时。
解决方法:
-
检查网络连接:确保你的系统可以正常访问互联网。
-
清除缓存:运行 yum clean all 或 dnf clean all 清除缓存,然后再尝试更新。
[root@Z yum.repos.d]# yum clean all
31 files removed
- 禁用仓库:如果特定仓库不稳定或有问题,可以临时禁用它。编辑 /etc/yum.repos.d/.repo 文件,将 enabled=1 改为 enabled=0 来禁用仓库。
cd /etc/yum.repos.d
[root@Z yum.repos.d]# ll
total 24
-rw-r--r-- 1 root root 1475 Jul 28 2023 AliYun.repo
-rw-r--r-- 1 root root 1919 Jan 10 2024 docker-ce.repo
-rw-r--r-- 1 root root 703 Jun 10 2022 epel-modular.repo
-rw-r--r-- 1 root root 664 Jun 10 2022 epel.repo
-rw-r--r-- 1 root root 781 Jun 10 2022 epel-testing-modular.repo
-rw-r--r-- 1 root root 742 Jun 10 2022 epel-testing.repo
[root@Z yum.repos.d]# vim docker-ce.repo
修复命令
yum update slirp4netns
yum update fuse-overlayfs
yum update container-selinux
[root@Z yum.repos.d]# ll
total 24
-rw-r--r-- 1 root root 1475 Jul 28 2023 AliYun.repo
-rw-r--r-- 1 root root 1919 Jan 10 2024 docker-ce.repo
-rw-r--r-- 1 root root 703 Jun 10 2022 epel-modular.repo
-rw-r--r-- 1 root root 664 Jun 10 2022 epel.repo
-rw-r--r-- 1 root root 781 Jun 10 2022 epel-testing-modular.repo
-rw-r--r-- 1 root root 742 Jun 10 2022 epel-testing.repo
[root@Z yum.repos.d]# vim docker-ce.repo
[root@Z yum.repos.d]# yum update slirp4netns
alinux3-os 6.5 MB/s | 5.8 MB 00:00
alinux3-updates 30 MB/s | 25 MB 00:00
alinux3-module 2.0 MB/s | 573 kB 00:00
alinux3-plus 34 MB/s | 25 MB 00:00
alinux3-powertools 9.6 MB/s | 1.6 MB 00:00
Extra Packages for Enterprise Linux 8 - x86_64 26 MB/s | 14 MB 00:00
Extra Packages for Enterprise Linux Modular 8 - x86_64 3.9 MB/s | 733 kB 00:00
Dependencies resolved.
==================================================================================================================================================================================================
Package Architecture Version Repository Size
==================================================================================================================================================================================================
Upgrading:
slirp4netns x86_64 1.2.3-1.al8 alinux3-updates 56 k
Transaction Summary
==================================================================================================================================================================================================
Upgrade 1 Package
Total download size: 56 k
Is this ok [y/N]: yum update fuse-overlayfs
Is this ok [y/N]: y
Downloading Packages:
slirp4netns-1.2.3-1.al8.x86_64.rpm 1.6 MB/s | 56 kB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.6 MB/s | 56 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Upgrading : slirp4netns-1.2.3-1.al8.x86_64 1/2
Cleanup : slirp4netns-1.2.0-2.al8.x86_64 2/2
Running scriptlet: slirp4netns-1.2.0-2.al8.x86_64 2/2
Verifying : slirp4netns-1.2.3-1.al8.x86_64 1/2
Verifying : slirp4netns-1.2.0-2.al8.x86_64 2/2
Upgraded:
slirp4netns-1.2.3-1.al8.x86_64
Complete!
[root@Z yum.repos.d]# yum update fuse-overlayfs
Last metadata expiration check: 0:00:38 ago on Fri 19 Jul 2024 11:10:34 PM CST.
Dependencies resolved.
==================================================================================================================================================================================================
Package Architecture Version Repository Size
==================================================================================================================================================================================================
Upgrading:
fuse-overlayfs x86_64 1.13-1.0.1.al8 alinux3-updates 70 k
Transaction Summary
==================================================================================================================================================================================================
Upgrade 1 Package
Total download size: 70 k
Is this ok [y/N]: y
Downloading Packages:
fuse-overlayfs-1.13-1.0.1.al8.x86_64.rpm 1.3 MB/s | 70 kB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.3 MB/s | 70 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Upgrading : fuse-overlayfs-1.13-1.0.1.al8.x86_64 1/2
Running scriptlet: fuse-overlayfs-1.13-1.0.1.al8.x86_64 1/2
Cleanup : fuse-overlayfs-1.11-1.0.1.al8.x86_64 2/2
Running scriptlet: fuse-overlayfs-1.11-1.0.1.al8.x86_64 2/2
Verifying : fuse-overlayfs-1.13-1.0.1.al8.x86_64 1/2
Verifying : fuse-overlayfs-1.11-1.0.1.al8.x86_64 2/2
Upgraded:
fuse-overlayfs-1.13-1.0.1.al8.x86_64
Complete!
[root@Z yum.repos.d]# yum update container-selinux
Last metadata expiration check: 0:05:04 ago on Fri 19 Jul 2024 11:10:34 PM CST.
Dependencies resolved.
==================================================================================================================================================================================================
Package Architecture Version Repository Size
==================================================================================================================================================================================================
Upgrading:
container-selinux noarch 2:2.229.0-2.al8 alinux3-updates 70 k
Transaction Summary
==================================================================================================================================================================================================
Upgrade 1 Package
Total download size: 70 k
Is this ok [y/N]: y
Downloading Packages:
container-selinux-2.229.0-2.al8.noarch.rpm 637 kB/s | 70 kB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 631 kB/s | 70 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Running scriptlet: container-selinux-2:2.229.0-2.al8.noarch 1/2
Upgrading : container-selinux-2:2.229.0-2.al8.noarch 1/2
Running scriptlet: container-selinux-2:2.229.0-2.al8.noarch 1/2
Cleanup : container-selinux-2:2.189.0-1.al8.noarch 2/2
Running scriptlet: container-selinux-2:2.189.0-1.al8.noarch 2/2
Running scriptlet: container-selinux-2:2.229.0-2.al8.noarch 2/2
Verifying : container-selinux-2:2.229.0-2.al8.noarch 1/2
Verifying : container-selinux-2:2.189.0-1.al8.noarch 2/2
Upgraded:
container-selinux-2:2.229.0-2.al8.noarch
Complete!
到此就更新成功了;
-
更新仓库:如果仓库地址有变更,需要更新 .repo 文件中的 baseurl 或 mirrorlist。
-
使用官方镜像:如果是 Docker 相关问题,确保你正在使用官方仓库。
-
检查防火墙设置:确保没有防火墙规则阻止了你的下载。
-
手动下载:尝试直接从仓库的 URL 手动下载元数据文件,并检查是否有错误信息。
-
查看日志:检查 YUM/DNF 日志文件(通常位于 /var/log/yum.log 或 /var/log/dnf.log),以获取更详细的错误信息。