docker的dnf makecache启动报错
2023-04-27 本文已影响0人
小KKKKKKKK
在docker desktop中点进容器,在日志中发现有报错,报错内容为:

根据提示,进入命令行中执行“systemctl status dnf-makecache.service”命令看问题
点进Terminal
执行
systemctl status dnf-makecache.service

根据告警告诉无法下载metadata,没有准备好跟mirrorlist连接
应该是跟yum有关系
执行
yum list
返回
CentOS Linux 8 - AppStream 85 B/s | 38 B 00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
故进入“/etc/yum.repo.d”中进行修改,我这里把路径下其他文件都修改了文件名,只留下CentOS-Linux-BaseOS.repo,把文件中的镜像路径改为阿里的镜像,“mirrors.aliyun.com”阿里镜像地址。
修改完成后
yum clean all
返回
0 files removed
yum list
哗啦啦刷一大堆
说明镜像通了,接下来重启容器,查看日志

可发现之前的报错,现在ok了,这个问题解决了