Docker没有vim如何安装,apt-get update报ERR404解决方案

问题描述

docker容器中安装vim报错
执行apt-get install vim后报错:

E: Unable to locate package vim

更新安装源也报错
docker容器中执行apt-get update后报错:

 #进入镜像命令
 #docker exec -it 镜像Id或镜像name /bin/bash
[root@tdengine ~]# docker exec -it xxxxx /bin/bash
 #更新安装源
root@b258a4f121b3:/# apt-get update
Ign http://security.debian.org jessie/updates InRelease
Ign http://deb.debian.org jessie InRelease
Ign http://security.debian.org jessie/updates Release.gpg
Ign http://deb.debian.org jessie-updates InRelease
Ign http://security.debian.org jessie/updates Release
Err http://security.debian.org jessie/updates/main amd64 Packages
Err http://security.debian.org jessie/updates/main amd64 Packages
Err http://security.debian.org jessie/updates/main amd64 Packages
Err http://security.debian.org jessie/updates/main amd64 Packages
Err http://security.debian.org jessie/updates/main amd64 Packages
  404  Not Found [IP: 151.101.194.132 80]
Ign http://deb.debian.org jessie-backports InRelease
Ign http://deb.debian.org jessie Release.gpg
Ign http://deb.debian.org jessie-updates Release.gpg
Ign http://deb.debian.org jessie-backports Release.gpg
Ign http://deb.debian.org jessie Release
Ign http://deb.debian.org jessie-updates Release
Ign http://deb.debian.org jessie-backports Release
Err http://deb.debian.org jessie/main amd64 Packages
  404  Not Found
Err http://deb.debian.org jessie-updates/main amd64 Packages
  404  Not Found
Err http://deb.debian.org jessie-backports/main amd64 Packages
  404  Not Found
W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages  404  Not Found [IP: 151.101.194.132 80]
W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages  404  Not Found
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages  404  Not Found
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.

原因分析:
这个错误表明你使用的操作系统版本,即 Debian 8 (jessie) 已经停止支持并已归档,因此官方软件源已经关闭。
所以更新操作系统包列表时就会遇到 404 错误。

解决方案:
如果要继续使用这个操作系统版本,你需要使用归档的 Debian 镜像源来更新包列表。
你可以在 /etc/apt/sources.list 文件中添加以下内容,指定归档源地址(直接执行一下命令即可)
 

#备份原文件
mv /etc/apt/sources.list /etc/apt/sources.list.bak
#添加源地址
echo "deb http://archive.debian.org/debian/ jessie main" >>/etc/apt/sources.list
echo "deb-src http://archive.debian.org/debian/ jessie main" >>/etc/apt/sources.list

 重新安装

root@b258a4f121b3:/# apt-get update
# 注意update执行完了之后可能还是会有报错,不过已经可以执行下面的安装语句了
root@b258a4f121b3:/# apt-get install -y vim


 

Step 8/42 : RUN apt-get clean && apt-get update && apt-get install --yes --no-install-recommends --no-install-suggests build-essential net-tools inetutils-ping libncurses5-dev libdigest-crc-perl libpopt-dev xxd liblzo2-dev zlib1g-dev lib32z1 libssl-dev libglib2.0-dev libreadline-dev libjson-c-dev libxml2-dev libsqlite3-dev sqlite3 libuv1-dev libxslt1-dev libfcgi-dev libevent-dev libyajl-dev liburiparser-dev libwebsockets-dev locales lua5.1 liblua5.1-dev python python3 python3-dev python3-pip git git-lfs subversion autoconf automake pkg-config ccache cmake ninja-build clang-tools-6.0 bison flex gettext ca-certificates libtool patch vim unzip uuid-dev wget curl cpio bc gawk gdb valgrind diffstat chrpath texinfo ssh openssh-client openssh-server netbase quilt protobuf-c-compiler dropbear-bin openvswitch-switch tmux dirmngr lighttpd alien mlocate iproute2 dos2unix lsb-release rsync gdisk man pax moreutils python3-dev python3-setuptools sudo ---> Running in 446c3200d801 Get:1 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB] Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [102 kB] Get:1 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB] Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [102 kB] Get:1 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB] Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [102 kB] Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease The following signatures were invalid: BADSIG 3B4FE6ACC0B21F32 Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com> Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease The following signatures were invalid: BADSIG 3B4FE6ACC0B21F32 Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com> Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [102 kB] Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [102 kB] Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [2411 kB] Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [1728 kB] Get:7 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [30.8 kB] Get:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [3786 kB] Get:9 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [20.6 kB] Get:10 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [64.0 kB] Reading package lists... W: GPG error: http://security.ubuntu.com/ubuntu bionic-security InRelease: The following signatures were invalid: BADSIG 3B4FE6ACC0B21F32 Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com> E: The repository 'http://security.ubuntu.com/ubuntu bionic-security InRelease' is not signed. W: GPG error: http://archive.ubuntu.com/ubuntu bionic InRelease: The following signatures were invalid: BADSIG 3B4FE6ACC0B21F32 Ubuntu Archive Automatic Signing Key (2012) <ftpmaster@ubuntu.com> E: The repository 'http://archive.ubuntu.com/ubuntu bionic InRelease' is not signed. The command '/bin/sh -c apt-get clean && apt-get update && apt-get install --yes --no-install-recommends --no-install-suggests build-essential net-tools inetutils-ping libncurses5-dev libdigest-crc-perl libpopt-dev xxd liblzo2-dev zlib1g-dev lib32z1 libssl-dev libglib2.0-dev libreadline-dev libjson-c-dev libxml2-dev libsqlite3-dev sqlite3 libuv1-dev libxslt1-dev libfcgi-dev libevent-dev libyajl-dev liburiparser-dev libwebsockets-dev locales lua5.1 liblua5.1-dev python python3 python3-dev python3-pip git git-lfs subversion autoconf automake pkg-config ccache cmake ninja-build clang-tools-6.0 bison flex gettext ca-certificates libtool patch vim unzip uuid-dev wget curl cpio bc gawk gdb valgrind diffstat chrpath texinfo ssh openssh-client openssh-server netbase quilt protobuf-c-compiler dropbear-bin openvswitch-switch tmux dirmngr lighttpd alien mlocate iproute2 dos2unix lsb-release rsync gdisk man pax moreutils python3-dev python3-setuptools sudo' returned a non-zero code: 100
最新发布
11-28
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

穗余

家庭条件困难,望有打赏援助生活

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值