文章目录

  • 问题
  • 解决方案(阿里云、centos7、centos8均是以此解决的)
    • 未具体指明 centos7 的镜像时,它会默认去找最新的镜像:失败(具体的shell脚本)
    • 具体指明使用centos7的镜像:成功(具体的shell脚本)

问题

Error: Failed to download metadata for repo ‘appstream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist
尝试过很多解决方案(包括:换镜像源,防火墙,selinux等),也换过很多系统(包括:阿里云服务器,centos7,centos8)都没有解决这个问题,最后指定了 centos镜像为 centos7 后成功了,阿里云服务器,centos7,centos8这三种环境均是以此为解决方案。
#猜测是最新的centos镜像存在问题,所以我更换为了centos7的镜像

解决方案(阿里云、centos7、centos8均是以此解决的)

  1. 查看本地镜像

未具体指明 centos7 的镜像时,它会默认去找最新的镜像:失败(具体的shell脚本)

docker pull centos:centos7
cat >>df2<<EOF
FROM centos
RUN yum install -y wget net-tools
CMD echo "Hello Wolrd"
EOF
docker build -f df2 -t image_name .
# . 是输出路径
# 上下文路径,是指 docker 在构建镜像,有时候想要使用到本机的文件(比如复制),docker build 命令得知这个路径后,会将路径下的所有内容打包。

具体指明使用centos7的镜像:成功(具体的shell脚本)

#如果要具体执行的话,请将上面那串代码也一并复制粘贴

sed "s/cen.*/centos:centos7/" df2 > df3
docker build -f df3 -t image_name .
docker images | grep image.*


Successfully built 348a7ee19977 Successfully tagged image_name:latest

#虽成功构建了镜像,但心累

没事学学docker:解决dockerfile出现的Error: Failed to download metadata for repo ‘appstream‘: Cannot prepar相关推荐

  1. 解决dockerfile出现的Error: Failed to download metadata for repo ‘appstream‘: Cannot prepar

    文章目录 问题 解决方案(阿里云.centos7.centos8均是以此解决的) 未具体指明 centos7 的镜像时,它会默认去找最新的镜像:失败(具体的shell脚本) 具体指明使用centos7 ...

  2. 解决使用Dockerfile更新centos镜像Failed to download metadata for repo‘AppStream’「CentOS」问题

    由于docker中的centos镜像是没有vim编辑器,net-tools等功能,于是使用Dockerfile构建新的centos镜像,我的Dockerfile如下(部分无关内容已省略): FROM ...

  3. centos8 通过dnf命令安装软件报Error: Failed to download metadata for repo ‘appstream‘ 解决办法

    今天在用centos8的dnf安装git里报错 dnf install git -yError: Failed to download metadata for repo 'appstream': C ...

  4. centos 关于“Error: Failed to download metadata for repo ‘appstream‘” 问题

    CentOS 8 于 2021 年 12 月 31 日结束生命周期 (EOL) CentOS 8 服务器无法下载 appstream 存储库的原因.由于无法删除该存储库,它通常会阻止整个服务器安装或更 ...

  5. 【DockerFile构建自定义镜像实操出现问题解决方案Failed to download metadata for repo ‘appstream‘: IPv4 forwarding disa】

    一.知识回顾 之前的内容都帮你整理好了,在这里哟! [0.Docker相关目录文章整理,可自行查看,包含多节内容] [1.Docker详细安装部署&阿里镜像地址配置] [2.Docker架构& ...

  6. CentOS 8报错 Failed to download metadata for repo ‘AppStream‘: Cannot download repomd.xml解决方法

    2021年12月31日CentOS 8 EOL.按照社区规则,CentOS 8的源地址http://mirror.centos.org/centos/8/内容已移除,目前第三方的镜像站中均已移除Cen ...

  7. 解决安装宝塔面板“ERROR: Failed to download, please try install again”错误

    晚上在阿里云买了服务器,在CentOS 7上安装宝塔面板的时候出现错误提示 "ERROR: Failed to download, please try install again!&quo ...

  8. Error: Failed to download resource “node_bottle_manifest“ 错误解决

    安装 brew install yarn 报如下错误: curl: (22) The requested URL returned error: 404 Error: Failed to downlo ...

  9. 【Mac】Mac下安装MySQL优化工具 percona-toolkit 报错 Error: Failed to download resource openssl@1.1

    1.背景 mac 下安装percona-toolkit 报错 Error: Failed to download resource "openssl@1.1" Download f ...

  10. 遇到问题--k8s--helm安装prometheus报错Error: failed to download “stable/prometheus-operator“

    情况 使用helm安装prometheus命令如下: helm install prometheus stable/prometheus-operator 遇到报错: Error: failed to ...

最新文章

  1. Mybatis3.4.x技术内幕(二十二):Mybatis一级、二级缓存原理分析
  2. excel不能插入activex控件_办公小技巧:制作更炫酷的Excel下拉菜单
  3. Django笔记06
  4. lnp和mysql分开安装_毕业设计之LNP+DISCUZ +分离的数据库操作
  5. sap系统搭建教程_SAP系统和微信集成的系列教程之十:如何在SAP C4C系统里直接回复消息给微信用户...
  6. vs.net 2005中文版下载
  7. 黑马程序员SpringBoot2全套教程学习笔记
  8. 阿克曼函数求解(递归和非递归)
  9. php获取qqkey源码,易语言取QQKEY源码
  10. STM32入门之GPIO详解
  11. 2020年最酷的十个无人机项目(下)
  12. ODL:OpenDayLight项目中子项目统计(二)
  13. 加州房价篇 (二) : 处理数据
  14. [转载]《博客园精华集》WF筛选结果(共39篇)
  15. 水果食用大全 -- 果品食疗 - 其他
  16. MyBatis 多对多关联映射
  17. php调用ua_php得到用户浏览器类型(UA) | 2hei's site
  18. 一文了解加密游戏illuvium新玩法:探索神兽世界
  19. Java MyShopping管理系统 > 购物结算+管理系统
  20. Single-stage目标检测网络YOLO相关背景知识

热门文章

  1. 【福利】PyTorch中文版官方教程来啦(附下载)
  2. 【无广告】一位算法工程师从30+场秋招面试中总结出的超强面经——目标检测篇...
  3. BERT模型—3.BERT模型在ner任务上的微调
  4. 深度学习TF—13.对抗生成网络—GAN
  5. LeetCode学习记录(4-6)
  6. 从零实现深度学习框架——实现Tensor的反向传播
  7. resnet18实现cifar10分类
  8. 如何成为一名合格的CRUD工程师?
  9. Go在容器运行时要注意的细节
  10. 3.5 RNN 层使用方法