docker容器无法执行vim如何解决

本文讲解"docker容器无法执行vim怎么解决",希望能够解决相关问题。

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

  • docker容器中执行vim失败

  • 安装文件

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

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

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

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

  • 完整步骤

    • 1:备份配置

    • 2:修改配置

    • 3:检查配置

    • 4:执行:apt-get update

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

    • 6:验证

  • 参考资料:

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

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

docker容器中执行vim失败

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

docker容器无法执行vim如何解决

我的版本 cat /etc/debian_version11.2

安装文件

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

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

docker容器无法执行vim如何解决

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

Ign:1 http://mirrors.163.com/debian jessie InReleaseIgn:2 http://mirrors.163.com/debian jessie-proposed-updates InReleaseIgn:3 http://mirrors.163.com/debian jessie-updates InReleaseIgn:4 http://mirrors.163.com/debian jessie-backports InReleaseIgn:5 http://mirrors.163.com/debian-security jessie/updates InReleaseGet:6 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease [116 kB]Err:7 http://mirrors.163.com/debian jessie Release404 Not Found [IP: 101.71.33.11 80]Err:8 http://mirrors.163.com/debian jessie-proposed-updates Release404 Not Found [IP: 101.71.33.11 80]Err:9 http://mirrors.163.com/debian jessie-updates Release404 Not Found [IP: 101.71.33.11 80]Err:10 http://mirrors.163.com/debian jessie-backports Release404 Not Found [IP: 101.71.33.11 80]Err:11 http://mirrors.163.com/debian-security jessie/updates Release404 Not Found [IP: 101.71.33.11 80]Reading package lists... DoneE: 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.

docker容器无法执行vim如何解决

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

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.listroot@a7e7ebb2ecad:/var/lib/apt/lists#root@a7e7ebb2ecad:/var/lib/apt/lists# cat /etc/apt/sources.listdeb http://mirrors.aliyun.com/debian/ stretch main non-free contribdeb-src http://mirrors.aliyun.com/debian/ stretch main non-free contribdeb http://mirrors.aliyun.com/debian-security stretch/updates maindeb-src http://mirrors.aliyun.com/debian-security stretch/updates maindeb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contribdeb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contribdeb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contribdeb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contribroot@a7e7ebb2ecad:/var/lib/apt/lists# apt-get updateIgn:1 http://mirrors.aliyun.com/debian stretch InReleaseIgn:2 http://mirrors.aliyun.com/debian-security stretch/updates InReleaseIgn:3 http://mirrors.aliyun.com/debian stretch-updates InReleaseIgn:4 http://mirrors.aliyun.com/debian stretch-backports InReleaseGet:5 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease [116 kB]Err:6 http://mirrors.aliyun.com/debian stretch Release404 Not Found [IP: 60.28.226.53 80]Err:7 http://mirrors.aliyun.com/debian-security stretch/updates Release404 Not Found [IP: 60.28.226.53 80]Err:8 http://mirrors.aliyun.com/debian stretch-updates Release404 Not Found [IP: 60.28.226.53 80]Err:9 http://mirrors.aliyun.com/debian stretch-backports Release404 Not Found [IP: 60.28.226.53 80]Reading package lists... DoneE: 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.

docker容器无法执行vim如何解决

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

#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

docker容器无法执行vim如何解决

完整步骤

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

docker容器无法执行vim如何解决

4:执行:apt-get update

docker容器无法执行vim如何解决

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

6:验证

vim /etc/hosts

docker容器无法执行vim如何解决

关于 "docker容器无法执行vim怎么解决" 就介绍到此。希望多多支持编程教程

下一章:docker的常用命令如何使用

docker的常用命令怎么使用:本文讲解"docker的常用命令如何使用",希望能够解决相关问题。docker常用命令列举常用的命令,不常用的已省略。1 启停类/帮助 命令启动docker: systemctl start docker停止 ...