本例在debian:buster-slim docker镜像中实验通过
1、启动docker实例
docker run -it --name debian debian:buster-slim bash
2、进入容器备份原始软件源配置文件
mv /etc/apt/sources.list /etc/apt/sources.list.bak
3、写入网易软件源地址或中科大软件源地址到source.list文件
cat > /etc/apt/sources.list << EOF deb http://mirrors.163.com/debian/ buster main contrib non-free # deb-src http://mirrors.163.com/debian/ buster main contrib non-free deb http://mirrors.163.com/debian/ buster-updates main contrib non-free # deb-src http://mirrors.163.com/debian/ buster-updates main contrib non-free deb http://mirrors.163.com/debian/ buster-backports main contrib non-free # deb-src http://mirrors.163.com/debian/ buster-backports main contrib non-free deb http://mirrors.163.com/debian-security buster/updates main contrib non-free # deb-src http://mirrors.163.com/debian-security buster/updates main contrib non-free EOF
或
cat > /etc/apt/sources.list << EOF deb http://mirrors.ustc.edu.cn/debian/ buster main contrib non-free # deb-src http://mirrors.ustc.edu.cn/debian/ buster main contrib non-free deb http://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free # deb-src http://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free deb http://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free # deb-src http://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free deb http://mirrors.ustc.edu.cn/debian-security buster/updates main contrib non-free # deb-src http://mirrors.ustc.edu.cn/debian-security buster/updates main contrib non-free EOF
4、执行apt-get update命令更新软件包索引
apt-get update
5、安装vim、unzip等软件包
apt-get install vim unzip