dockerfile报错:“/bin/sh -c yum -y install vim net-tools wget“ did not complete successfully: exit code

这篇具有很好参考价值的文章主要介绍了dockerfile报错:“/bin/sh -c yum -y install vim net-tools wget“ did not complete successfully: exit code。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

FROM centos:7

MAINTAINER zhangsan zs@163.com

LABEL version="1.0" description="this is a custom centos image"

ENV WORKPATH /usr/local

WORKDIR $WORKPATH

RUN yum -y install vim net-tools wget

CMD /bin/bash

docker build -t cento7:1.0 .    #执行以上docker file报错

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

尝试过更换yum源、检查网络等等,均无法解决。

最后将docker 重启了,但是生产环境需要谨慎重启docker

systemctl restart docker

再次执行

[root@test hw]# docker build -t cento7:1.0 .
[+] Building 64.5s (5/6)                                                                                                              
 => [internal] load .dockerignore                                                                                      0.0s      0.0s
[+] Building 64.7s (5/6)                                                                                               0.0s      0.0s         rnal] load build definition from Dockerfile                                                                   0.0s      0.0s
 => [internal] load .dockerignore                                                                                      0.0s      0.0s    0.0sernal] load metadata for docker.io/library/centos:7                                                            0.0s      0.0s
 => => transferring context: 2B                                                                                        0.0s      0.0s    0.0sED [2/3] WORKDIR /usr/local                                                                                    0.0s      0.0s
 => [internal] load build definition from Dockerfile                                                                  64.5s     64.2s    0.0s Running transaction check                                                                                                   
 => => transferring dockerfile: 302B                                                                                                     0.0s Transaction test succeeded                                                                                                  
 => [internal] load metadata for docker.io/library/centos:7                                                                              0.0s   Installing : gpm-libs-1.20.7-6.el7.x86_64                                1/35                                             
 => [1/3] FROM docker.io/library/centos:7                                                                                                0.0s
 => CACHED [2/3] WORKDIR /usr/local                                                                                    0.0s
 => [3/3] RUN yum -y install vim net-tools wget                                                                    [+] Building 64.8s (5/6)                                                                                                    Running transaction check                                                                                  => [internal] load .dockerignore                                                                                      0.0s Running transaction test                                                                                   => => transferring context: 2B                                                                                        0.0s Transaction test succeeded                                                                                 => [internal] load build definition from Dockerfile                                                                   0.0s Running transaction                                                                                        => => transferring dockerfile: 302B                                                                                   0.0s   Installing : gpm-libs-1.20.7-6.el7.x86_64                                1/35                            => [internal] load metadata for docker.io/library/centos:7                                                            0.0s   Installing : 2:vim-filesystem-7.4.629-8.el7_9.x86_64                     2/35                            => [1/3] FROM docker.io/library/centos:7                                                                              0.0s
 => CACHED [2/3] WORKDIR /usr/local                                                                                [+] Building 102.5s (7/7) FINISHED                                                                                                                                                           
 => [internal] load .dockerignore                                                                                                                                                       0.0s => => transferring context: 2B                                                                                                                                                         0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                    0.0s => => transferring dockerfile: 302B                                                                                                                                                    0.0s
 => [internal] load metadata for docker.io/library/centos:7                                                                                                                             0.0s => [1/3] FROM docker.io/library/centos:7                                                                                                                                               0.0s
 => CACHED [2/3] WORKDIR /usr/local                                                                                                                                                     0.0s => [3/3] RUN yum -y install vim net-tools wget                                                                                                                                        90.4s
 => exporting to image                                                                                                                                                                 11.9s => => exporting layers                                                                                                                                                                11.9s
 => => writing image sha256:9c42ab93536027309742507295ac8481238448ce43c8cd0719c1750862a102a3                                                                                            0.0s  => => naming to docker.io/library/cento7:1.0

发现问题解决。

[root@test hw]# docker images                                                                                                                                                                REPOSITORY      TAG       IMAGE ID       CREATED          SIZE                                                                                                                               
cento7          1.0       9c42ab935360   18 seconds ago   469MB
hello-my-word   latest    280551f2b1ed   2 hours ago      861kB
centos          7         eeb6ee3f44bd   21 months ago    204MB

 可参考学习!文章来源地址https://www.toymoban.com/news/detail-728429.html

到了这里,关于dockerfile报错:“/bin/sh -c yum -y install vim net-tools wget“ did not complete successfully: exit code的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • iproute2 和 net-tools 介绍

    路由(Routing)          在网络通信中, “路由” 是一个网络层的术语。 路由是指设备从一个接口上收到 数据包 ,根据数据包的目的 地址 进行定向并转发到另一个接口的过程。 路由表 则是若干条路由信息的一个集合体。在路由表中,一条路由信息也被称为一个 路由

    2024年02月04日
    浏览(28)
  • 运行Dockerfile报错:ERROR: failed to solve: process “/bin/sh -c sed -ri ‘s#archive.ubuntu.com...exit code

    docker build 使用Dockerfile打包tengine的镜像 Dockerfile文件写错???– 检查没有问题 docker build命令执行问题???–检查没有问题

    2024年02月12日
    浏览(40)
  • 一篇搞定Ubuntu 22.04 下联网问题、 ifconfig、net-tools不能用的问题(亲测可行_仅供参考)

    刚下载的Ubuntu 联不上网、找不到ifconfig (告诉你要安装net-tools)但是输入 sudo apt install net-tools 又发现 E:无法定位软件包 net-tools 鼠标跟着“—”走 step1:打开虚拟网络编辑器 编辑—虚拟网络编辑器 —更改设置 —选择“NAT”模式—移除网络 —添加网络(哪一个都行问题不大

    2023年04月26日
    浏览(43)
  • -bash: vim: 未找到命令 yum install -y 是什么意思_yum 命令讲解

    1.先查看是否已安装,命令:rpm -qa | grep vim 发现只装了部分包,缺少安装。 2.按需下载vim包比如 yum -y install vim-enhanced 差不多就下面这些包了 vim-common-7.4.629-8.el7_9.x86_64 vim-filesystem-7.4.629-8.el7_9.x86_64 vim-X11-7.4.629-8.el7_9.x86_64 vim-minimal-7.4.629-8.el7_9.x86_64 vim-enhanced-7.4.629-8.el7_9.x86_64  

    2024年02月02日
    浏览(39)
  • 10.docker exec -it /bin/bash报错解决、sh与bash区别

    进入容器时,报如下错误 将bin/bash换成bin/sh 制作镜像时使用了精简版,只装了sh命令,未安装bash。 Shell是一种应用程序,该应用程序提供了一个界面,用户通过这个界面访问操作系统内核的服务。Shell 是一个用 C 语言编写的程序,是用户使用 Linux 的桥梁。Shell 既是一种命令

    2024年04月08日
    浏览(59)
  • docker容器日志报错:/docker-entrypoint.sh: exec: line 10: /bin/bash: not found(去掉/bin/bash)

    这个错误提示表明eclipse-mosquitto镜像生成的容器内部找不到 /bin/bash 这个命令,可能是由于在容器镜像中没有安装 Bash 或在执行脚本时路径不正确导致的。如果你使用的是官方的 eclipse-mosquitto 镜像,那么这个问题一般不会出现。 如果你在 Dockerfile 中指定了自己的 ENTRYPOINT 或

    2024年02月09日
    浏览(42)
  • 解决dockerfile创建镜像时pip install报错的bug

    使用docker-compose创建django容器 解决dockerfile创建镜像时pip install报错的bug 执行service docker restart

    2024年02月07日
    浏览(48)
  • pycharm 无法加载pip3安装包报错:python packing tools not found. install packing tools

    win+R输入cmd,然后输入代码,回车,出现install sucessfully表示成功 Python 2.7.9 + 或 Python 3.4+ 以上版本都自带 pip 工具。 查看是否已经安装 pip 可以使用以下命令: 下载安装包使用以下命令: 例如我们安装 numpy 包: 我们也可以轻易地通过以下的命令来移除软件包: 例如我们移除

    2024年02月05日
    浏览(53)
  • brew install报错Error: No developer tools installed. Error: Command failed with exit 128: git

    先来解决第一个问题 Error: No developer tools installed. Install the Command Line Tools: xcode-select --install 然后升级一下brew,出现警告。然后再次尝试安装tree 出现如下错误: fatal: not in a git directory Error: Command failed with exit 128: git 在终端输入 Homebrew 3.6.20 fatal: detected dubious ownership in repositor

    2024年02月05日
    浏览(55)
  • 成功解决/bin/sh: cc: command not found和/bin/sh: g++: command not found

    成功解决/bin/sh: cc: command not found和/bin/sh: g++: command not found 目录 解决问题 解决思路 解决方法 make: cc: Command not found /bin/sh: cc: command not found expr: syntax error expr: syntax error make: cc: Command not found I llama.cpp build info: I UNAME_S:   Linux I UNAME_P:   x86_64 I UNAME_M:   x86_64 I CFLAGS:    -I. -Icommo

    2024年02月04日
    浏览(48)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包