docker debian 更换源
时间: 2023-10-20 15:07:58 浏览: 148
在 Docker 中更换 Debian 软件源,可以按照以下步骤进行操作:
1.备份源列表文件:
```
cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2.编辑源列表文件:
```
nano /etc/apt/sources.list
```
3.将原来的内容注释掉,添加以下内容:
```
# 中科大源(推荐)
deb https://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free
deb-src https://mirrors.ustc.edu.cn/debian/ stretch main contrib non-free
# 清华源
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free
# 阿里源
deb https://mirrors.aliyun.com/debian/ stretch main contrib non-free
deb-src https://mirrors.aliyun.com/debian/ stretch main contrib non-free
# 163 源
deb http://mirrors.163.com/debian/ stretch main contrib non-free
deb-src http://mirrors.163.com/debian/ stretch main contrib non-free
```
注意:以上四个源任选一个即可,不要同时添加多个。
4.更新源列表:
```
apt-get update
```
这样就将 Debian 软件源更换成了中国的镜像源,可以更快地下载软件包。
阅读全文