Docker容器中安装vim工具
一、进入容器
进入docker
容器修改文件提示bash: vim: command not found
,于是需要在docker
中安装相关的工具。
于是执行安装工具命令
#查询容器
docker ps
#其中96656852148f为容器编号
docker exec -it 96656852148f /bin/bash
但是提示 List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
,看来是权限不足。
docker exec -it -u 0 96656852148f /bin/bash
或者
docker exec -itu root 96656852148f /bin/bash
二、更新源
向/etc/apt/sources.list文件中,写入源地址
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" >/etc/apt/sources.list
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >>/etc/apt/sources.list
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >>/etc/apt/sources.list
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >>/etc/apt/sources.list
更新源
apt-get update
三、安装vim工具
安装vim等工具
apt-get install vim