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

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值