1.先进入容器


docker exec -it bash

2.进入apt-get 配置目录


cd /etc/apt

3.执行备份命令


cp sources.list sources.list.bak

4.查看版本


cat /etc/os-release

5.选择相应版本的源,执行如下所有echo命令,修改成国内镜像源【163镜像:https://mirrors.163.com/.help/debian.html


echo "">sources.list
echo "deb http://mirrors.163.com/debian/ buster main non-free contrib">>sources.list
echo "deb http://mirrors.163.com/debian/ buster-updates main non-free contrib">>sources.list
echo "deb http://mirrors.163.com/debian/ buster-backports main non-free contrib">>sources.list
echo "deb-src http://mirrors.163.com/debian/ buster main non-free contrib">>sources.list
echo "deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib">>sources.list
echo "deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib">>sources.list
echo "deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib">>sources.list
echo "deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib">>sources.list

6.查看文件 是否修改成功


cat sources.list

7.更新apt-get


apt-get update

8.安装vim


apt-get install vim