当前位置: 首页 > news >正文

docker的服务/容器缺少vim问题

背景/问题:
docker的服务/容器缺少vim问题

bash: vim: command not found
在这里插入图片描述

在docker的mysql服务中安装Vim

1、执行apt-get update

root@6d8d17e320a0:/# apt-get update

问题:文件下载失败

Err: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’
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.

在这里插入图片描述

【解决方案】

1、运行以下命令以授予对该文件角色的read权限:resolv.conf

root@6d8d17e320a0:/etc# chmod o+r /etc/resolv.conf

2、重启docker

备注:下面的c_mysql是我的mysql服务的容器名

退出mysql服务
root@6d8d17e320a0:/# exit
exit
重启docker
[root@25zkf mysql]# sudo service docker restart
Redirecting to /bin/systemctl restart docker.service
启动mysql容器
[root@25zkf mysql]# docker start c_mysql
进入mysql服务
[root@25zkf mysql]# docker exec -it c_mysql  /bin/bash

2、下载Vim

再次执行:

root@6d8d17e320a0:/# apt-get update
root@6d8d17e320a0:/# apt-get install vim
y

在这里插入图片描述

文章参考:
ubuntu - Docker:解决“ deb.debian.org”的临时故障
docker mysql 中文乱码
Docker 问题 | 编辑文件出现 bash: vi: command not found

http://www.lryc.cn/news/123436.html

相关文章:

  • HCIP-OpenStack
  • 前端:Vue.js学习
  • MySQL到Oracle快速上手
  • 机器人CPP编程基础-01第一个程序Hello World
  • 前后端分离------后端创建笔记(03)前后端对接(下)
  • Leet code1049 最后一块石头的重量II
  • Rust语法:变量,函数,控制流,struct
  • LVS简介及LVS-DR搭建
  • Java基础篇--日期时间类
  • Vue生命周期函数 详解
  • 判断链表有环的证明
  • 百度屏蔽词有哪些?其中就有移民关键词指数被屏蔽?
  • 代码随想录day02
  • VR时代真的到来了?
  • docker run 命令转化为 docker-compose 工具
  • php如何对接伪原创api
  • 设计模式行为型——模板模式
  • 12.Eclipse导入Javaweb项目
  • 探索自动化网页交互的魔力:学习 Selenium 之旅【超详细】
  • css常用样式和不常用样式
  • 【小练习】交互式网格自定义增删改错误记录及解决(进行中)
  • 云渲染效果不对?云渲染前的四个细节表明你的问题出在这里!
  • 翻转二叉树
  • 检测新突破 | AlignDet:支持各类检测器自监督新框架(ICCV2023)
  • 03.Show and Tell
  • QStackedWidget 的使用
  • 大数据--难点--地图的制作
  • 【AI作画】使用Stable Diffusion的艺术二维码完全生成攻略
  • SQLAlchemy------更多查询
  • 13-数据结构-串以及KMP算法,next数组