ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

在容器中使用dockerfile安装vim、telnet、nettools等软件构建镜像出现的问题

2021-09-14 17:32:40  阅读:199  来源: 互联网

标签:jessie http com telnet vim updates deb main dockerfile


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

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

RUN echo 'deb http://mirrors.aliyun.com/Debian/ xenial main restricted universe multiverse \n\
           deb http://mirrors.aliyun.com/Debian/ xenial-security main restricted universe multiverse \n\
           deb http://mirrors.aliyun.com/Debian/ xenial-updates main restricted universe multiverse \n\
           deb http://mirrors.aliyun.com/Debian/ xenial-proposed main restricted universe multiverse \n\
           deb http://mirrors.aliyun.com/Debian/ xenial-backports main restricted universe multiverse \n\
           deb-src http://mirrors.aliyun.com/Debian/ xenial main restricted universe multiverse \n\
           deb-src http://mirrors.aliyun.com/Debian/ xenial-security main restricted universe multiverse \n\
           deb-src http://mirrors.aliyun.com/Debian/ xenial-updates main restricted universe multiverse \n\
           deb-src http://mirrors.aliyun.com/Debian/ xenial-proposed main restricted universe multiverse \n\
           deb-src http://mirrors.aliyun.com/Debian/ xenial-backports main restricted universe multiverse \n'\
              > /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

我们来试一下

没问题咯

标签:jessie,http,com,telnet,vim,updates,deb,main,dockerfile
来源: https://www.cnblogs.com/shook/p/15268622.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有