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


    问题描述

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

    E: Unable to locate package vim

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

    1. #进入镜像命令
    2. #docker exec -it 镜像Id或镜像name /bin/bash
    3. [root@tdengine ~]# docker exec -it xxxxx /bin/bash
    4. #更新安装源
    5. root@b258a4f121b3:/# apt-get update
    6. Ign http://security.debian.org jessie/updates InRelease
    7. Ign http://deb.debian.org jessie InRelease
    8. Ign http://security.debian.org jessie/updates Release.gpg
    9. Ign http://deb.debian.org jessie-updates InRelease
    10. Ign http://security.debian.org jessie/updates Release
    11. Err http://security.debian.org jessie/updates/main amd64 Packages
    12. Err http://security.debian.org jessie/updates/main amd64 Packages
    13. Err http://security.debian.org jessie/updates/main amd64 Packages
    14. Err http://security.debian.org jessie/updates/main amd64 Packages
    15. Err http://security.debian.org jessie/updates/main amd64 Packages
    16. 404 Not Found [IP: 151.101.194.132 80]
    17. Ign http://deb.debian.org jessie-backports InRelease
    18. Ign http://deb.debian.org jessie Release.gpg
    19. Ign http://deb.debian.org jessie-updates Release.gpg
    20. Ign http://deb.debian.org jessie-backports Release.gpg
    21. Ign http://deb.debian.org jessie Release
    22. Ign http://deb.debian.org jessie-updates Release
    23. Ign http://deb.debian.org jessie-backports Release
    24. Err http://deb.debian.org jessie/main amd64 Packages
    25. 404 Not Found
    26. Err http://deb.debian.org jessie-updates/main amd64 Packages
    27. 404 Not Found
    28. Err http://deb.debian.org jessie-backports/main amd64 Packages
    29. 404 Not Found
    30. W: Failed to fetch http://security.debian.org/dists/jessie/updates/main/binary-amd64/Packages 404 Not Found [IP: 151.101.194.132 80]
    31. W: Failed to fetch http://deb.debian.org/debian/dists/jessie/main/binary-amd64/Packages 404 Not Found
    32. W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found
    33. W: Failed to fetch http://deb.debian.org/debian/dists/jessie-backports/main/binary-amd64/Packages 404 Not Found
    34. 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 文件中添加以下内容,指定归档源地址(直接执行一下命令即可)
     

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

     重新安装

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


     

  • 相关阅读:
    系统架构设计师之系统应用集成
    [附源码]计算机毕业设计JAVA疫情防控下高校教职工健康信息管理系统
    深入浅出PyTorch——PyTorch可视化
    使用新的 NVIDIA Isaac Foundation 模型和工作流程创建、设计和部署机器人应用程序
    如何分析精准分析出问题件
    微盟十年:踩准节奏,持续增长
    使用JMeter创建FTP测试计划
    文件系统,软硬链接
    STM32F103VET6基于STM32CubeMX创建EXTI外部中断工程
    一点思考|关于「引领性研究」的一点感悟
  • 原文地址:https://blog.csdn.net/wwh1st/article/details/133075686