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:/# 

速度比之前快很多

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM