docker容器无法执行vim的解决方案

 更新时间:2023年05月15日 10:15:08   作者:Danger_Life  
这篇文章主要介绍了docker容器无法执行vim的解决方案,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下

docker容器无法执行vim【已解决】

解决问题直接看完整步骤目录

docker容器中执行vim失败

bash: ll: command not found
bash: vim: command not found
bash: vi: command not found
安装vim依旧报错

我的版本 cat /etc/debian_version
11.2

安装文件

# 正常步骤,但是第一步下载非常慢,需要更换一下地址
1:apt-get update
2: apt-get install -y vim

没更换之前,速度非常的慢

【失败】这里我更换了163的但是报错

Ign:1 http://mirrors.163.com/debian jessie InRelease
Ign:2 http://mirrors.163.com/debian jessie-proposed-updates InRelease
Ign:3 http://mirrors.163.com/debian jessie-updates InRelease
Ign:4 http://mirrors.163.com/debian jessie-backports InRelease
Ign:5 http://mirrors.163.com/debian-security jessie/updates InRelease
Get:6 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease [116 kB]
Err:7 http://mirrors.163.com/debian jessie Release
404 Not Found [IP: 101.71.33.11 80]
Err:8 http://mirrors.163.com/debian jessie-proposed-updates Release
404 Not Found [IP: 101.71.33.11 80]
Err:9 http://mirrors.163.com/debian jessie-updates Release
404 Not Found [IP: 101.71.33.11 80]
Err:10 http://mirrors.163.com/debian jessie-backports Release
404 Not Found [IP: 101.71.33.11 80]
Err:11 http://mirrors.163.com/debian-security jessie/updates Release
404 Not Found [IP: 101.71.33.11 80]
Reading package lists... Done
E: The repository 'http://mirrors.163.com/debian jessie Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.163.com/debian jessie-proposed-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.163.com/debian jessie-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.163.com/debian jessie-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.163.com/debian-security jessie/updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

【失败】这里我更换了阿里的第一种报错

root@a7e7ebb2ecad:/var/lib/apt/lists# echo -e "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib \ndeb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib \ndeb http://mirrors.aliyun.com/debian-security stretch/updates main \ndeb-src http://mirrors.aliyun.com/debian-security stretch/updates main \ndeb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib \ndeb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib \ndeb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib \ndeb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" > /etc/apt/sources.list
root@a7e7ebb2ecad:/var/lib/apt/lists#
root@a7e7ebb2ecad:/var/lib/apt/lists# cat /etc/apt/sources.list
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
root@a7e7ebb2ecad:/var/lib/apt/lists# apt-get update
Ign:1 http://mirrors.aliyun.com/debian stretch InRelease
Ign:2 http://mirrors.aliyun.com/debian-security stretch/updates InRelease
Ign:3 http://mirrors.aliyun.com/debian stretch-updates InRelease
Ign:4 http://mirrors.aliyun.com/debian stretch-backports InRelease
Get:5 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease [116 kB]
Err:6 http://mirrors.aliyun.com/debian stretch Release
404 Not Found [IP: 60.28.226.53 80]
Err:7 http://mirrors.aliyun.com/debian-security stretch/updates Release
404 Not Found [IP: 60.28.226.53 80]
Err:8 http://mirrors.aliyun.com/debian stretch-updates Release
404 Not Found [IP: 60.28.226.53 80]
Err:9 http://mirrors.aliyun.com/debian stretch-backports Release
404 Not Found [IP: 60.28.226.53 80]
Reading package lists... Done
E: The repository 'http://mirrors.aliyun.com/debian stretch Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/debian-security stretch/updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/debian stretch-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://mirrors.aliyun.com/debian stretch-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

【成功】::::这里我更换了阿里的第二种成功

#Aliyun Apt Source 阿里云镜像源
echo "deb http://mirrors.aliyun.com/debian/ bullseye main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye main contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/debian/ bullseye-updates main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/debian/ bullseye-backports main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/debian/ bullseye-proposed-updates main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye-proposed-updates main contrib" >> /etc/apt/sources.list
root@a7e7ebb2ecad:/# apt-get update
Get:1 http://mirrors.aliyun.com/debian bullseye InRelease [116 kB]
Get:2 http://mirrors.aliyun.com/debian bullseye-updates InRelease [44.1 kB]           
Get:3 http://mirrors.aliyun.com/debian bullseye-backports InRelease [49.0 kB]
Get:4 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease [116 kB]
Get:5 http://mirrors.aliyun.com/debian bullseye-proposed-updates InRelease [54.0 kB]
Get:6 http://mirrors.aliyun.com/debian bullseye/contrib Sources [43.2 kB]
Get:7 http://mirrors.aliyun.com/debian bullseye/main Sources [8,637 kB]        
Get:8 http://mirrors.aliyun.com/debian bullseye/main amd64 Packages [8,183 kB]
Get:9 http://mirrors.aliyun.com/debian bullseye/contrib amd64 Packages [50.6 kB]
Get:10 http://mirrors.aliyun.com/debian bullseye-updates/main Sources [4,812 B]
Get:11 http://mirrors.aliyun.com/debian bullseye-updates/main amd64 Packages [14.6 kB]
Get:12 http://mirrors.aliyun.com/debian bullseye-backports/main Sources [429 kB]
Get:13 http://mirrors.aliyun.com/debian bullseye-backports/contrib Sources [4,280 B]
Get:14 http://mirrors.aliyun.com/debian bullseye-backports/main amd64 Packages [419 kB]
Get:15 http://mirrors.aliyun.com/debian bullseye-backports/contrib amd64 Packages [5,692 B]
Get:16 http://mirrors.aliyun.com/debian bullseye-proposed-updates/main Sources [8,072 B]
Get:17 http://mirrors.aliyun.com/debian bullseye-proposed-updates/main amd64 Packages [29.3 kB]
Fetched 18.2 MB in 6s (2,999 kB/s)                                                                                                                                                              
Reading package lists... Done

完整步骤

1:备份配置

cp /etc/apt/sources.list /etc/apt/sources.list.bak

2:修改配置

# Aliyun Apt Source 阿里云镜像源
echo "deb http://mirrors.aliyun.com/debian/ bullseye main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye main contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/debian/ bullseye-updates main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/debian/ bullseye-backports main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main contrib" >> /etc/apt/sources.list
echo "deb http://mirrors.aliyun.com/debian/ bullseye-proposed-updates main contrib" >> /etc/apt/sources.list
echo "deb-src http://mirrors.aliyun.com/debian/ bullseye-proposed-updates main contrib" >> /etc/apt/sources.list

3:检查配置

cat /etc/apt/sources.list

4:执行:apt-get update

5:执行:apt-get install -y vim

6:验证

vim /etc/hosts

参考资料:

https://blog.csdn.net/yimaoya/article/details/125345414
https://blog.csdn.net/peng2hui1314/article/details/113247648

到此这篇关于docker容器无法执行vim的文章就介绍到这了,更多相关docker容器无法执行vim内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • 更改Docker默认数据目录解决部署空间不足问题

    更改Docker默认数据目录解决部署空间不足问题

    随着使用 Docker 的时间增加,存储在默认数据目录(通常是 /var/lib/docker)中的数据量也会不断增大,最终可能导致服务器上的存储空间不足,这篇文章将详细介绍如何更改 Docker 的默认数据目录,以便在服务器上释放存储空间并优化资源利用,需要的朋友可以参考下
    2024-06-06
  • docker搭建fastdfs环境的方法步骤

    docker搭建fastdfs环境的方法步骤

    在实际使用中,通过源码编译安装过程非常复杂,但是通过docker快速构建却非常容易,本文主要介绍了docker搭建fastdfs环境,具有一定的参考价值,感兴趣的可以了解一下
    2022-06-06
  • docker部署jupyter的详细教程

    docker部署jupyter的详细教程

    这篇文章主要介绍了docker部署jupyter的相关知识,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2023-12-12
  • Docker 容器虚拟化的实用技巧总结

    Docker 容器虚拟化的实用技巧总结

    这篇文章主要介绍了Docker 容器虚拟化的实用技巧总结的相关资料,需要的朋友可以参考下
    2016-10-10
  • 修改Docker默认存储路径的步骤详解

    修改Docker默认存储路径的步骤详解

    随着Docker技术的广泛应用,它极大地简化了复杂项目的部署与维护流程,仅凭单一镜像即可轻松运行,然而,随着数据量不断增长,Docker的默认数据存储方式可能逐渐成为挑战,本文给大家介绍了如何修改Docker默认存储路径,解决系统盘占用90%+问题,需要的朋友可以参考下
    2024-09-09
  • 如何使用Docker快速启动Nacos集群

    如何使用Docker快速启动Nacos集群

    使用 Docker 和 Docker Compose 启动 Nacos 集群是一个快速且高效的方法,它可以让你在隔离的环境中测试和运行 Nacos 服务,并且能够从外部访问,通过遵循上述步骤,你可以轻松地在你的本地机器或服务器上部署 Nacos 集群,感兴趣的朋友跟随小编一起看看吧
    2024-09-09
  • Docker连接宿主Redis的方法步骤

    Docker连接宿主Redis的方法步骤

    本文主要介绍了Docker连接宿主Redis的方法步骤,可以轻松地使用Docker容器与宿主机上的Redis进行交互,实现高效的数据存储和共享,,具有一定的参考价值,感兴趣的可以了解一下
    2024-01-01
  • 关于docker容器优雅退出的问题详解

    关于docker容器优雅退出的问题详解

    在Docker大火的今天,我们能够非常方便的使用容器打包我们的应用程序,并且将它在我们的服务器上部署并运行起来。而下面这篇文章主要给大家介绍了关于docker容器如何优雅退出的问题,需要的朋友可以参考下。
    2017-09-09
  • 使用docker-compose.yml构建镜像的方法

    使用docker-compose.yml构建镜像的方法

    docker-compose是docker提供的一个命令行工具,用来定义和运行由多个容器组成的应用,这篇文章主要介绍了使用docker-compose.yml构建镜像的方法,需要的朋友可以参考下
    2023-05-05
  • docker中mysql数据库密码修改方法

    docker中mysql数据库密码修改方法

    长时间使用非关系型数据库MongoDB近期遇到突然想使用mysql却发现mysql密码忘记了,下面这篇文章主要给大家介绍了关于docker中mysql数据库密码修改方法的相关资料,需要的朋友可以参考下
    2023-11-11

最新评论