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