1. Docker下安装vim报错如下
root@72822008d953:/usr/share/nginx/html# apt-get install vim
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package vim
2. 更换镜像
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free" >/etc/apt/sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free" >>/etc/apt/sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >>/etc/apt/sources.list
echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free" >>/etc/apt/sources.list
3.再次执行apt-get update
Get:1 https://mirrors.tuna.tsinghua.edu.cn/debian buster InRelease [122 kB]
Get:2 https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates InRelease [56.6 kB]
Get:3 https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports InRelease [51.4 kB]
Get:4 https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates InRelease [34.8 kB]
Get:5 https://mirrors.tuna.tsinghua.edu.cn/debian buster/contrib amd64 Packages [50.1 kB]
Get:6 https://mirrors.tuna.tsinghua.edu.cn/debian buster/main amd64 Packages [7911 kB]
Get:7 https://mirrors.tuna.tsinghua.edu.cn/debian buster/non-free amd64 Packages [87.7 kB]
Get:8 https://mirrors.tuna.tsinghua.edu.cn/debian buster-updates/main amd64 Packages [8788 B]
Get:9 https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports/main amd64 Packages [489 kB]
Get:10 https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports/non-free amd64 Packages [37.3 kB]
Get:11 https://mirrors.tuna.tsinghua.edu.cn/debian buster-backports/contrib amd64 Packages [9184 B]
Get:12 https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates/main amd64 Packages [338 kB]
Get:13 https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates/non-free amd64 Packages [556 B]
Fetched 9195 kB in 4s (2139 kB/s)
Reading package lists... Done
4.安装 apt-get install -y vim