与
ESC
输入关键词搜索文章

Docker默认ubuntu镜像:bash: vi: command not found

全文约 313 字预计阅读 2 分钟
docker纯净ubuntu镜像里面是没有vi命令的,敲vi命令时提示说:vi: command not found。 这时候可以安装vim替换。 这时候需要敲:apt-get update,这个命令的作用是:同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,这样才能获取到最新的软件包。 等更新完毕以后再敲命令:apt-get install -y vim命令即可。 如果下载速度异常慢而且可能中端,可以配置下国内镜像源,因为还没有vi编辑功能,只能使用echo命令导入文件。
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse" >/etc/apt/sources.list
echo "deb http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse" >>/etc/apt/sources.list
echo "deb http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse" >>/etc/apt/sources.list
echo "deb-src http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse" >>/etc/apt/sources.list
echo "deb-src http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse" >>/etc/apt/sources.list
echo "deb-src http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse" >>/etc/apt/sources.list
其中wily版本根据系统修改,查看Ubuntu使用apt-get更新慢解决方法修改镜像 更新安装源
apt-get update
再执行:apt-get install -y vim安装
Docker默认ubuntu镜像:bash: vi: command not found
分享

发表评论

评论 0 条

暂无评论,来说点什么吧。