首页 > 系统相关 >执行`docker build -f ./dockerfile -t mycentos7:v1 .`时 `RUN yum install -y vim` 报错

执行`docker build -f ./dockerfile -t mycentos7:v1 .`时 `RUN yum install -y vim` 报错

时间:2024-08-01 21:51:47浏览次数:10  
标签:RUN 0.770 centos mycentos7 vim 报错 install yum

执行docker build -f ./dockerfile -t RUN yum install -y vim 报错

1.报错信息


[+] Building 0.9s (5/6)                                                                                                                                                                                                                                     docker:default
 => [internal] load build definition from centos7-dockerfile                                                                                                                                                                                                          0.0s
 => => transferring dockerfile: 188B                                                                                                                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/centos:7                                                                                                                                                                                                           0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                       0.0s
 => CACHED [1/3] FROM docker.io/library/centos:7                                                                                                                                                                                                                      0.0s
 => ERROR [2/3] RUN yum install -y vim                                                                                                                                                                                                                                0.8s
------                                                                                                                                                                                                                                                                     
 > [2/3] RUN yum install -y vim:                                                                                                                                                                                                                                           
0.409 Loaded plugins: fastestmirror, ovl                                                                                                                                                                                                                                   
0.509 Determining fastest mirrors                                                                                                                                                                                                                                          
0.768 Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=container error was
0.768 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
0.770 
0.770 
0.770  One of the configured repositories failed (Unknown),
0.770  and yum doesn't have enough cached data to continue. At this point the only
0.770  safe thing yum can do is fail. There are a few ways to work "fix" this:
0.770 
0.770      1. Contact the upstream for the repository and get them to fix the problem.
0.770 
0.770      2. Reconfigure the baseurl/etc. for the repository, to point to a working
0.770         upstream. This is most often useful if you are using a newer
0.770         distribution release than is supported by the repository (and the
0.770         packages for the previous distribution release still work).
0.770 
0.770      3. Run the command with the repository temporarily disabled
0.770             yum --disablerepo=<repoid> ...
0.770 
0.770      4. Disable the repository permanently, so yum won't use it by default. Yum
0.770         will then just ignore the repository until you permanently enable it
0.770         again or use --enablerepo for temporary usage:
0.770 
0.770             yum-config-manager --disable <repoid>
0.770         or
0.770             subscription-manager repos --disable=<repoid>
0.770 
0.770      5. Configure the failing repository to be skipped, if it is unavailable.
0.770         Note that yum will try to contact the repo. when it runs most commands,
0.770         so will have to try and fail each time (and thus. yum will be be much
0.770         slower). If it is a very temporary problem though, this is often a nice
0.770         compromise:
0.770 
0.770             yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
0.770 
0.770 Cannot find a valid baseurl for repo: base/7/x86_64
------
centos7-dockerfile:4
--------------------
   2 |     MAINTAINER author
   3 |     
   4 | >>> RUN yum install -y vim
   5 |     
   6 |     CMD /bin/bash
--------------------
ERROR: failed to solve: process "/bin/sh -c yum install -y vim" did not complete successfully: exit code: 1

2. dockerfile文件内容

FROM centos:7
MAINTAINER author

RUN yum install -y vim

CMD /bin/bash

WORKDIR /usr

3.解决方法

FROM centos:7
MAINTAINER zfm

RUN cd /etc/yum.repos.d/ \
&& sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* \
&& sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*  \
&& yum install -y vim

CMD /bin/bash

WORKDIR /usr

标签:RUN,0.770,centos,mycentos7,vim,报错,install,yum
From: https://www.cnblogs.com/discourage/p/18337650

相关文章

  • 【问题解决方案】npm install报错问题:npm ERR! - 多种解决方案,总有一种可以解决
    @[toc]1.问题重述安装package.json里面的包,使用npminstall但是报错2.解决方案方案1.确认根目录正确确认自己的目录是根目录(也就是处于./package.json可以找到的位置)例如--根目录----package.json----其他文件----其他文件方案2.确认文件名正确确认自己的pack......
  • LangChain的LCEL和Runnable你搞懂了吗
    LangChain的LCEL估计行业内的朋友都听过,但是LCEL里的RunnablePassthrough、RunnableParallel、RunnableBranch、RunnableLambda又是什么意思?什么场景下用?1、LCEL的定义和原理LangChain的核心是Chain,即对多个组件的一系列调用。LCEL是LangChain定义的表达式语言,是一种更加高效......
  • vmware 更新时间报错修复
     LoadingmirrorspeedsfromcachedhostfileCouldnotretrievemirrorlisthttp://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stockerrorwas14:curl#6-"Coulsolvehost:mirrorlist.centos.org;未知的错误" 问题原因出现这个错误......
  • WebApi连接数据库报错:尝试加载Oracle客户端时引发BadImageFormatException
    出现的问题  今天在公司用C#搭建一个WebApi服务,接受请求并连接数据库进行查询,但连接数据库时报错:尝试加载Oracle客户端时引发BadImageFormatException。如果安装32位客户端组件的情况下以64位模式运行,将出现此问题。问题点  我之后了解点,确定了OracleClient客户端确实安装......
  • SQL注入——报错注入
    1.何为报错注入?报错注入是一种在SQL注入攻击中利用数据库的错误信息来获取敏感数据的技术。当网站的web服务器开启了错误回显,并且数据库执行出错时,攻击者可以通过构造特定的SQL语句,让数据库在报错信息中泄露敏感数据。2.利用报错注入有哪些前提条件?Web应用程序未关闭数据库......
  • qtui更改后报错:-1: error: [Makefile.Debug:7745: ui_widget.h] Error 1,如何解决?
    qtui更改后报错:-1:error:[Makefile.Debug:7745:ui_widget.h]Error1,如何解决?在使用Qt开发时,遇到-1:error:[Makefile.Debug:7745:ui_widget.h]Error1这样的错误通常是因为ui_widget.h文件未能正确生成。这个文件是由Qt的uic(用户界面编译器)工具生成的......
  • 完美使用 Google Cloud Run:为单个作业中的每个流程创建新的执行 ID
    我目前正在使用Prefect云来编排不同的任务,并且我正在使用CloudRunPush工作池将这些任务作为作业部署在GoogleCloudRun上。这是我面临的情况:每次运行流程时,它都会创建一个新的任务在CloudRun上工作。然而,这不是我想要的行为。相反,我希望每个部署都有一个作业,具有......
  • Linux中expect命令使用报错“invalid command name “Y“ while executing “Y“ invo
    1.执行expect命令的时候一直在报错:spawnshsetup.sh#invalidcommandname"Y"  whileexecuting"Y"  invokedfromwithin"expect"[Y]Yes,Iagree. [N]No,Idon'tagree."",如下图所示:其中的源码:    /usr/bin/expect&l......
  • Ubuntu升级Jenkins导致无法启动,报错Failed to start Jenkins Continuous Integration
    背景:从23年底部署jenkins后就没升过级,安装插件顺手更新后导致无法启动,服务端运行状态显示jenkinssystemd[1]:FailedtostartJenkinsContinuousIntegrationServer.无法重新启动的状态信息root@jenkins:~#sudosystemctlstatusjenkins●jenkins.service-Jenkins......
  • pip安装mysqlclient报错
    pip安装mysqlclient报错报错信息Exception:Cannotfindvalidpkg-configname.SpecifyMYSQLCLIENT_CFLAGSandMYSQLCLIENT_LDFLAGSenvvarsmanually这个问题通常是由于缺少mysqlclient的开发包或者相关的环境变量导致的。要解决这个问题,你可以尝试以下几个步骤......