debian10更换apt源(包括Dockerfile)

更新sources.list

如果是在 Dockerfile 中呢?

直接添加指令 ADD sources.list /etc/apt/。 然后把上面的源写成 sources.list文件,与 Dockerfile 放在 同一目录下。

备份一份源文件

mv /etc/apt/sources.list /etc/apt/sources.list.bak

修改文件

nano /etc/apt/sources.list

编辑添加下面的源,完成后,依次ctrl+O 、回车、ctrl+X即可,然后执行apt-get update更新数据库。

或者用

vim /etc/apt/sources.lis

华为云镜像

deb https://mirrors.huaweicloud.com/debian/ buster main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ buster main non-free contrib
deb https://mirrors.huaweicloud.com/debian-security buster/updates main
deb-src https://mirrors.huaweicloud.com/debian-security buster/updates main
deb https://mirrors.huaweicloud.com/debian/ buster-updates main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ buster-updates main non-free contrib
deb https://mirrors.huaweicloud.com/debian/ buster-backports main non-free contrib
deb-src https://mirrors.huaweicloud.com/debian/ buster-backports main non-free contrib

阿里云镜像

deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib

163镜像

deb http://mirrors.163.com/debian/ buster main non-free contrib
deb-src http://mirrors.163.com/debian/ buster main non-free contrib
deb http://mirrors.163.com/debian-security buster/updates main
deb-src http://mirrors.163.com/debian-security buster/updates main
deb http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib
deb http://mirrors.163.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib

清华镜像

deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib
deb http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main non-free contrib
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main non-free contrib

发表评论