docker 执行build yum失败

docker 执行build yum失败

月光魔力鸭

2023-05-02 23:53 阅读 675 喜欢 0

错误信息

docker build yum install Could not retrieve **

 > [2/2] RUN yum install -y wget:                                                                                                                                                                        
#0 0.308 Loaded plugins: fastestmirror, ovl
#0 0.367 Determining fastest mirrors
#0 0.373 
#0 0.373 
#0 0.373  One of the configured repositories failed (Unknown),
#0 0.373  and yum doesn't have enough cached data to continue. At this point the only
#0 0.373  safe thing yum can do is fail. There are a few ways to work "fix" this:
#0 0.373 
#0 0.373      1. Contact the upstream for the repository and get them to fix the problem.
#0 0.373 
#0 0.373      2. Reconfigure the baseurl/etc. for the repository, to point to a working
#0 0.373         upstream. This is most often useful if you are using a newer
#0 0.373         distribution release than is supported by the repository (and the
#0 0.373         packages for the previous distribution release still work).
#0 0.373 
#0 0.373      3. Run the command with the repository temporarily disabled
#0 0.373             yum --disablerepo=<repoid> ...
#0 0.373 
#0 0.373      4. Disable the repository permanently, so yum won't use it by default. Yum
#0 0.373         will then just ignore the repository until you permanently enable it
#0 0.373         again or use --enablerepo for temporary usage:
#0 0.373 
#0 0.373             yum-config-manager --disable <repoid>
#0 0.373         or
#0 0.373             subscription-manager repos --disable=<repoid>
#0 0.373 
#0 0.373      5. Configure the failing repository to be skipped, if it is unavailable.
#0 0.373         Note that yum will try to contact the repo. when it runs most commands,
#0 0.373         so will have to try and fail each time (and thus. yum will be be much
#0 0.373         slower). If it is a very temporary problem though, this is often a nice
#0 0.373         compromise:
#0 0.373 
#0 0.373             yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
#0 0.373 
#0 0.373 Cannot find a valid baseurl for repo: base/7/x86_64
#0 0.373 Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
#0 0.373 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

昨天刚安装完成docker的时候还是可以使用的,今天再用的时候就出现这个问题了(中间服务器是否重启不太清楚) 。

最后通过以下方法解决:原因是nameserver的问题

解决步骤

  1. 修改resolv.conf文件,增加nameserver
vim /etc/resolv.conf 

nameserver 8.8.8.8
nameserver 114.114.114.114
  1. 保存后如果重启的话,还会还原的这里需要进行锁定
chattr +i /etc/resolv.conf   //resolv被锁定,即使root也不能修改
  1. 如果需要继续修改
chattr -i /etc/resolv.conf
  1. 重启network 查看是否还存在(centos8)
systemctl restart NetworkManager

转载请注明出处: https://chrunlee.cn/article/docker-build-yum-error.html


感谢支持!

赞赏支持
提交评论
评论信息 (请文明评论)
暂无评论,快来快来写想法...
推荐
本篇文章以一个实际的小项目为主题进行从头到尾的讲解实现,该项目总计开发时长约6小时,主要是有很多页面或功能都是现成的,直接复制过来的,剩下的就调整下样式、字段内容等。
最近有个小功能需要一些基础数据,找了一下在小程序上有发现,暂时还没找到他的网站,想着把这些数据爬一些下来做为基础数据使用的。本来还想着直接反编译小程序的,没想到微信变更了加密方式,以前反编译的路子走不通了。
上一章,我们学习和了解了websocket 是什么以及初始搭建,接下来,我们继续了解,如何进行广播以及对应的私聊呢。
反爬有很多手段,字体反爬就是其中之一。之前一直都是听过,但是却没怎么在实际爬虫中遇到过,最近在一个爬虫题目网站上看到了,试了试,发现还挺麻烦,当然自己从头研究字体肯定麻烦,简单的是模块多的是,选几个就过了。
登录方式现在非常多,不过像我这种小站让用户自己注册基本是不可能的了,只能依赖现有的第三方的登录来集成,之前有集成github,不过这个太过针对性,这里准备集成QQ互联登录,慢慢记录下。
写到这里,基本上就完成了我之前一篇文章中写的,我要做一个自己的图床的小程序了。在最初我要做图床的时候,发现在谷歌扩展程序上一无所知,所以才开始学习的这个,到这一步,至少能勉强能跑通自己的小程序了。
与python后端进行联调,后端协议为jsonrpc ,这里简单记录下jsonrpc的通用请求函数,并附带几个栗子
最近有一个任务一直在占满cpu, 总是会让我的服务器宕机,可是还得跑,想来想去想到了docker,印象中可以对cpu进行限制,这里简单记录下过程。