docker出现问题:容器中bash: vi: command not found解决方案
发布日期:2021-05-07 23:38:06 浏览次数:23 分类:精选文章

本文共 1545 字,大约阅读时间需要 5 分钟。


问题

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

在这里插入图片描述

这是因为vim没有安装。

解决方案

使用如下命令安装:

apt-get updateapt-get install vim

然后就可以了。


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

在这里插入图片描述

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

 

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

解决方法:

sudo systemctl restart docker

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

在这里插入图片描述

没问题了。

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

上一篇:Docker 容器网络访问原理,SNAT和DNAT
下一篇:docker将数据从宿主机挂载到容器的方式(二)

发表评论

最新留言

第一次来,支持一个
[***.219.124.196]2025年04月19日 08时03分55秒