docker 中安装apt-get install vim 失败,且apt-get update 报404

在docker 中安装vim时,安装失败。在更新apt-get时,报错如下:

root@a8a94b78ebf0:/# apt-get update    
Ign:1 http://deb.debian.org/debian stretch InRelease                                                                  
Ign:2 http://deb.debian.org/debian stretch-updates InRelease                                                          
Ign:3 http://deb.debian.org/debian stretch Release
Ign:4 http://deb.debian.org/debian stretch-updates Release
Ign:5 http://security.debian.org stretch/updates InRelease
Ign:6 http://deb.debian.org/debian stretch/main amd64 Packages
Ign:7 http://deb.debian.org/debian stretch/main all Packages
Ign:8 http://security.debian.org stretch/updates Release
Ign:9 http://deb.debian.org/debian stretch-updates/main amd64 Packages
Ign:10 http://security.debian.org stretch/updates/main all Packages
Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
Ign:12 http://security.debian.org stretch/updates/main amd64 Packages
Ign:6 http://deb.debian.org/debian stretch/main amd64 Packages
Ign:10 http://security.debian.org stretch/updates/main all Packages
Ign:7 http://deb.debian.org/debian stretch/main all Packages
Ign:12 http://security.debian.org stretch/updates/main amd64 Packages
Ign:10 http://security.debian.org stretch/updates/main all Packages
Ign:12 http://security.debian.org stretch/updates/main amd64 Packages
Ign:9 http://deb.debian.org/debian stretch-updates/main amd64 Packages
Ign:10 http://security.debian.org stretch/updates/main all Packages
Ign:12 http://security.debian.org stretch/updates/main amd64 Packages
Ign:10 http://security.debian.org stretch/updates/main all Packages
Ign:12 http://security.debian.org stretch/updates/main amd64 Packages
Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
Ign:6 http://deb.debian.org/debian stretch/main amd64 Packages
Ign:10 http://security.debian.org stretch/updates/main all Packages
Ign:7 http://deb.debian.org/debian stretch/main all Packages
Err:12 http://security.debian.org stretch/updates/main amd64 Packages
  404  Not Found [IP: 146.75.114.132 80]
Ign:9 http://deb.debian.org/debian stretch-updates/main amd64 Packages
Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
Ign:6 http://deb.debian.org/debian stretch/main amd64 Packages
Ign:7 http://deb.debian.org/debian stretch/main all Packages
Ign:9 http://deb.debian.org/debian stretch-updates/main amd64 Packages
Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
Ign:6 http://deb.debian.org/debian stretch/main amd64 Packages
Ign:7 http://deb.debian.org/debian stretch/main all Packages
Ign:9 http://deb.debian.org/debian stretch-updates/main amd64 Packages
Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
Err:6 http://deb.debian.org/debian stretch/main amd64 Packages
  404  Not Found [IP: 146.75.114.132 80]
Ign:7 http://deb.debian.org/debian stretch/main all Packages
Err:9 http://deb.debian.org/debian stretch-updates/main amd64 Packages
  404  Not Found [IP: 146.75.114.132 80]
Ign:11 http://deb.debian.org/debian stretch-updates/main all Packages
Reading package lists... Done
W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://security.debian.org stretch/updates Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages  404  Not Found [IP: 146.75.114.132 80]
E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages  404  Not Found [IP: 146.75.114.132 80]
E: Failed to fetch http://security.debian.org/dists/stretch/updates/main/binary-amd64/Packages  404  Not Found [IP: 146.75.114.132 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

解决方法:

1、备份/etc/apt/sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、更新/etc/apt/sources.list文件

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

重新更新apt-get:apt-get update  

更新完后,再次安装vim:apt-get install vim -y

安装成功

 

来源:https://blog.csdn.net/wwh1st/article/details/133075686

 

posted @ 2024-02-14 15:22  西夏一品唐  阅读(614)  评论(0编辑  收藏  举报