Docker容器apt-get update更新慢
一、进入容器
#查询容器
docker ps
#其中96656852148f为容器编号
docker exec -it 96656852148f /bin/bash
二、备份源
cp /etc/apt/sources.list /etc/apt/sources.list.bak
三、清空源
echo > /etc/apt/sources.list
查看源是否清空
cat /etc/apt/sources.list
四、写入新源
向/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
六、安装工具
apt-get install wget
apt-get install python3-pip