docker出现问题:容器中bash: vi: command not found解决方案

红太狼 2022-11-05 03:11 553阅读 0赞

docker使用教程相关系列 目录


问题

我们在创建基础容器之后,进入容器,进行编辑配置文件的时候,需要使用vim或者vi命令,但是会出现:
在这里插入图片描述

  1. 这是因为vim没有安装。

解决方案

使用如下命令安装:

  1. apt-get update
  2. apt-get install vim

然后就可以了。


如果 这个时候 安装也还是会出现 异常

在这里插入图片描述

  1. root@446d7cf1606c:/etc/mysql# apt-get update
  2. Err:1 http://security.debian.org/debian-security buster/updates InRelease
  3. Temporary failure resolving 'security.debian.org'
  4. Err:2 http://repo.mysql.com/apt/debian buster InRelease
  5. Temporary failure resolving 'repo.mysql.com'
  6. Err:3 http://deb.debian.org/debian buster InRelease
  7. Temporary failure resolving 'deb.debian.org'
  8. 0% [Connecting to deb.debian.org]
  9. Err:4 http://deb.debian.org/debian buster-updates InRelease
  10. Temporary failure resolving 'deb.debian.org'
  11. Reading package lists... Done
  12. W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease Temporary failure resolving 'deb.debian.org'
  13. W: Failed to fetch http://security.debian.org/debian-security/dists/buster/updates/InRelease Temporary failure resolving 'security.debian.org'
  14. W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease Temporary failure resolving 'deb.debian.org'
  15. W: Failed to fetch http://repo.mysql.com/apt/debian/dists/buster/InRelease Temporary failure resolving 'repo.mysql.com'
  16. W: Some index files failed to download. They have been ignored, or old ones used instead.
  17. root@446d7cf1606c:/etc/mysql#

从 异常我们可以看出来,安装找不到源。

解决方法:

  1. sudo systemctl restart docker

对没错,重启docker即可。目的是为了,让源…等等配置文件重新启动,然后再重新对接接口下载。

在这里插入图片描述
没问题了。

参考这个博主的解决方案:

https://pea328.blog.csdn.net/article/details/105010261

发表评论

表情:
评论列表 (有 0 条评论,553人围观)

还没有评论,来说两句吧...

相关阅读