错误内容

docker build 阶段报错如下:

Sending build context to Docker daemon 2.048 kB
Step 1/3 : FROM centos:7---> 8652b9f0cb4c
Step 2/3 : RUN yum -y update---> Running in 4e4e11d880f3Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
14: curl#56 - "Recv failure: Connection reset by peer"One of the configured repositories failed (Unknown),and yum doesn't have enough cached data to continue. At this point the onlysafe thing yum can do is fail. There are a few ways to work "fix" this:1. Contact the upstream for the repository and get them to fix the problem.2. Reconfigure the baseurl/etc. for the repository, to point to a workingupstream. This is most often useful if you are using a newerdistribution release than is supported by the repository (and thepackages for the previous distribution release still work).3. Run the command with the repository temporarily disabledyum --disablerepo=<repoid> ...4. Disable the repository permanently, so yum won't use it by default. Yumwill then just ignore the repository until you permanently enable itagain or use --enablerepo for temporary usage:yum-config-manager --disable <repoid>orsubscription-manager repos --disable=<repoid>5. Configure the failing repository to be skipped, if it is unavailable.Note that yum will try to contact the repo. when it runs most commands,so will have to try and fail each time (and thus. yum will be be muchslower). If it is a very temporary problem though, this is often a nicecompromise:yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=trueCannot find a valid baseurl for repo: base/7/x86_64
The command '/bin/sh -c yum -y update' returned a non-zero code: 1

Dockerdile 为:

FROM centos:7RUN yum -y updateENTRYPOINT ["tail", "-f","/dev/null"]

解决

多半是镜像源的问题,换成aliyun的源就好了

下载 http://mirrors.aliyun.com/repo/Centos-7.repo 替换 /etc/yum.repos.d/CentOS-Base.repo 即可

Dockerfile 修改为:

FROM centos:7RUN curl  http://mirrors.aliyun.com/repo/Centos-7.repo > /etc/yum.repos.d/CentOS-Base.repo
RUN  yum clean all && yum makecache RUN yum -y updateENTRYPOINT ["tail", "-f","/dev/null"]

参考

使用Dockerfile时Error: Failed to download metadata for repo 'AppStream

Docker build 报错 “ Cannot find a valid baseurl for repo: base/7/x86_64 ” 解决相关推荐

  1. CentOS7用yum安装软件报:Cannot find a valid baseurl for repo: base/7/x86_64

    CentOS7用yum安装软件报:Cannot find a valid baseurl for repo: base/7/x86_64 问题:Cannot find a valid baseurl ...

  2. yum命令详解和报错 Cannot find a valid baseurl for repo: base

    文章目录 1 yum命令 1.1 yum简介 1.2 yum安装 1.3 yum配置 1.4 配置本地yum源 1.4.1 关于repo 文件的格式 1.5 配置国内yum源 1.5.1 上海交通大学 ...

  3. CentOS 7 安装报错:Cannot find a valid baseurl for repo: base/7/x86_6

    如果是docker中centos报错,则重启docker服务,service docker restart, 详细参考<docker端口映射或启动容器时报错>https://blog.cs ...

  4. Linux安装Apache报错:Cannot find a valid baseurl for repo: base/7/x86_64解决方案

    Linux安装Apache报错:Cannot find a valid baseurl for repo: base/7/x86_64解决方案 参考文章: (1)Linux安装Apache报错:Can ...

  5. Linux下的Cannot find a valid baseurl for repo: base/7/x86_64问题记载

    Linux学习安装docker记载 1.安装尝试安装docker出现Cannot find a valid baseurl for repo: base/7/x86_64问题 [root@localh ...

  6. Centos7 Cannot find a valid baseurl for repo: base/7/x86_64

    今天我是在一台堡垒机上安装mysql,中间安装服务时,报错 我的情况时可以ping同百度的ip,ping不同百度的域名 我在 /etc/resolv.conf文件开头加上 nameserver 114 ...

  7. CENTOS7错误:Cannot find a valid baseurl for repo: base/7/x86_6

    撸了今年阿里.头条和美团的面试,我有一个重要发现.......>>> 问题 要解决Cannot find a valid baseurl for repo: base/7/x86_6 ...

  8. yum出错Error: Cannot find a valid baseurl for repo: base

    关注微信公众号"虾米聊吧",每天更新一篇技术文章,文章内容涵盖架构师成长必经之路应掌握的技术,一起学习,一起交流. 最近在安装mysql的rpm包时,出现了一个问题, 当使用命令: ...

  9. docker build报错

    docker build 遇到问题 "can  not stat ... APPData\Local\Application Data" 解决方法: 转载于:https://www ...

最新文章

  1. ssh调用expect使用以及shell同时传入两个参数调用
  2. 【Java基础】基本类型与运算
  3. 网络编程学习笔记(非阻塞accept)
  4. CentOS6.5下用yum安装 git .
  5. 2020暨阳学院园林计算机考研考场,【图片】2020考研,老学长教你如何规划!【计算机考研吧】_百度贴吧...
  6. 电脑计算机d盘有用吗,d盘不见了,教您电脑d盘不见了怎么解决
  7. Python扩展库scipy中值滤波算法的应用
  8. 如何修改docker swarm节点的hostname
  9. Windows XP 系统服务项优化
  10. 一个专注SQL优化的IDEA插件(支持DataGrip/Pycharm等) - PawSQL Advisor
  11. cad插件苹果系统_CAD看图软件mac版|CAD迷你看图 for Mac下载 v4.0.0 官方版_最火软件站...
  12. PC电源供电接口知识大科普
  13. Linux下rpm软件包rpm命令的安装及卸载
  14. 第48节 C语言课程总结与展望
  15. iOS清理缓存的简单实现
  16. 光电特性传感器实验台
  17. 鸿蒙操作系统详细流程,鸿蒙系统的启动流程
  18. 默认禁用SMB1协议的Samba 4.11-RC1 发布了
  19. Redis【10】-Redis发布订阅
  20. Atcode120E 1D Party

热门文章

  1. 教会你ECshop安装百度分享按钮教程
  2. windows驱动ddk环境设置
  3. 数据结构与算法较好的视频
  4. JS-108~161
  5. 人工智能导论:清览作业
  6. 域名使用HTTPS的相关配置
  7. 【2020年11月】研读和改进淘宝自动下单程序
  8. jsp常见面试题(1)
  9. 常用SQL语句大全,数据分析师入门必备!
  10. WIN10手动替换系统文件