zoukankan      html  css  js  c++  java
  • 在容器中使用dockerfile安装vim、telnet、nettools等软件构建镜像出现的问题

    由于有需要在容器中使用vim,telnet等软件,所以我们需要在容器内安装,因为网络等其他原因,我选择在Dockerfile里进行安装

    正常安装:在/etc/apt/sources.list内配置正确的镜像源即可

    RUN echo 'deb http://mirrors.aliyun.com/Debian/ xenial main restricted universe multiverse 
    
               deb http://mirrors.aliyun.com/Debian/ xenial-security main restricted universe multiverse 
    
               deb http://mirrors.aliyun.com/Debian/ xenial-updates main restricted universe multiverse 
    
               deb http://mirrors.aliyun.com/Debian/ xenial-proposed main restricted universe multiverse 
    
               deb http://mirrors.aliyun.com/Debian/ xenial-backports main restricted universe multiverse 
    
               deb-src http://mirrors.aliyun.com/Debian/ xenial main restricted universe multiverse 
    
               deb-src http://mirrors.aliyun.com/Debian/ xenial-security main restricted universe multiverse 
    
               deb-src http://mirrors.aliyun.com/Debian/ xenial-updates main restricted universe multiverse 
    
               deb-src http://mirrors.aliyun.com/Debian/ xenial-proposed main restricted universe multiverse 
    
               deb-src http://mirrors.aliyun.com/Debian/ xenial-backports main restricted universe multiverse 
    '
                  > /etc/apt/sources.list
    RUN ["apt-get", "update"]
    RUN ["apt-get","install","vim","-y"]
    

    但是我这里会出现问题

    Err http://deb.debian.org jessie-backports/main amd64 Packages
      404  Not Found
    Err http://mirrors.163.com jessie-proposed-updates/main Sources
      404  Not Found [IP: 1.193.221.38 80]
    Err http://mirrors.163.com jessie-proposed-updates/non-free Sources
      404  Not Found [IP: 1.193.221.38 80]
    Err http://mirrors.163.com jessie-proposed-updates/contrib Sources
      404  Not Found [IP: 1.193.221.38 80]
    Err http://mirrors.163.com jessie-proposed-updates/main amd64 Packages
      404  Not Found [IP: 1.193.221.38 80]
    Err http://mirrors.163.com jessie-proposed-updates/non-free amd64 Packages
      404  Not Found [IP: 1.193.221.38 80]
    Err http://mirrors.163.com jessie-proposed-updates/contrib amd64 Packages
      404  Not Found [IP: 1.193.221.38 80]
    Fetched 18.7 MB in 24s (777 kB/s)
    W: Failed to fetch http://mirrors.163.com/debian/dists/jessie-proposed-updates/main/source/Sources  404  Not Found [IP: 1.193.221.38 80]
    
    W: Failed to fetch http://mirrors.163.com/debian/dists/jessie-proposed-updates/non-free/source/Sources  404  Not Found [IP: 1.193.221.38 80]
    
    W: Failed to fetch http://mirrors.163.com/debian/dists/jessie-proposed-updates/contrib/source/Sources  404  Not Found [IP: 1.193.221.38 80]
    
    W: Failed to fetch http://mirrors.163.com/debian/dists/jessie-proposed-updates/main/binary-amd64/Packages  404  Not Found [IP: 1.193.221.38 80]
    
    W: Failed to fetch http://mirrors.163.com/debian/dists/jessie-proposed-updates/non-free/binary-amd64/Packages  404  Not Found [IP: 1.193.221.38 80]
    
    W: Failed to fetch http://mirrors.163.com/debian/dists/jessie-proposed-updates/contrib/binary-amd64/Packages  404  Not Found [IP: 1.193.221.38 80]
    
    W: Failed to fetch http://deb.debian.org/debian/dists/jessie-backports/main/binary-amd64/Packages  404  Not Found
    
    E: Some index files failed to download. They have been ignored, or old ones used instead.
    The command 'apt-get update' returned a non-zero code: 100
    
    

    本以为是源的问题,结果换了一堆源没有任何用,废了半天时间,头疼

    后来找到一种解决办法,还是在Dockerfile内增加

    RUN echo "deb [check-valid-until=no] http://cdn-fastly.deb.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list
    RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
    RUN sed -i '/deb http://deb.debian.org/debian jessie-updates main/d' /etc/apt/sources.list
    RUN apt-get -o Acquire::Check-Valid-Until=false update
    RUN apt-get install -y vim
    RUN apt-get install -y telnet
    RUN apt-get install -y net-tools
    
    

    我们来试一下

    没问题咯

  • 相关阅读:
    【解决】Ubuntu命令行弹出光驱的方法
    【8086汇编基础】02寻址方式和MOV指令
    【8086汇编基础】03变量、数组和常量的处理
    Ubuntu12.10 内核源码外编译 linux模块编译驱动模块的基本方法
    【8086汇编基础】05常用函数库文件emu8086.inc
    Ubuntu12.10 使用DNW传数据 进行ARM开发板烧写
    【8086汇编基础】04中断
    【8086汇编基础】01汇编语言简要介绍
    飞凌OK6410开发板移植uboot官方最新版uboot2012.10.tar.bz2
    【8086汇编基础】00基础知识各种进制的数据
  • 原文地址:https://www.cnblogs.com/shook/p/15268622.html
Copyright © 2011-2022 走看看