其他分享
首页 > 其他分享> > docker容器内apt更换国内阿里源

docker容器内apt更换国内阿里源

作者:互联网

一、备份/etc/apt/sources.list

root@nginx-demo-deployment-59fbc48594-8gns5:/# mv  /etc/apt/sources.list /etc/apt/sources.list.bak

二、写入阿里源内容

root@nginx-demo-deployment-59fbc48594-8gns5:/# echo "deb http://mirrors.aliyun.com/debian jessie main">>/etc/apt/sources.list
root@nginx-demo-deployment-59fbc48594-8gns5:/# echo "deb http://mirrors.aliyun.com/debian jessie-updates main">>/etc/apt/sources.list
root@nginx-demo-deployment-59fbc48594-8gns5:/# 
root@nginx-demo-deployment-59fbc48594-8gns5:/# cat /etc/apt/sources.list
deb http://mirrors.aliyun.com/debian jessie main
deb http://mirrors.aliyun.com/debian jessie-updates main

三、清空apt缓存,执行更新

root@nginx-demo-deployment-59fbc48594-8gns5:/# apt-get clean
root@nginx-demo-deployment-59fbc48594-8gns5:/# apt-get update
Ign:1 http://mirrors.aliyun.com/debian jessie InRelease
Get:2 http://mirrors.aliyun.com/debian jessie-updates InRelease [16.3 kB]
Get:3 http://mirrors.aliyun.com/debian jessie Release [77.3 kB]
Get:4 http://mirrors.aliyun.com/debian jessie Release.gpg [1652 B]
Get:5 http://mirrors.aliyun.com/debian jessie/main amd64 Packages [6818 kB]
Fetched 6913 kB in 3s (2017 kB/s)   
Reading package lists... Done
root@nginx-demo-deployment-59fbc48594-8gns5:/# 

速度比之前快很多

 

标签:容器,http,jessie,mirrors,apt,aliyun,docker,debian
来源: https://www.cnblogs.com/sky-cheng/p/14265227.html