Dokcer容器内执行apt-get update慢的问题

阿里云官方镜像站: https://developer.aliyun.com/mirror/

  1. 查看镜像debian版本:

    cat /etc/debian_version

2:清空/etc/apt/sources.list文件

echo > /etc/apt/sources.list

3:查看/etc/apt/sources.list内容

cat /etc/apt/sources.list

4:向/etc/apt/sources.list文件写入阿里云镜像地址,具体地址查看阿里云镜像站,根据debian版本确定镜像地址

cat >> /etc/apt/sources.list <<EOF
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
EOF

posted @ 2021-02-03 15:55  MaskerFan  阅读(424)  评论(0编辑  收藏  举报