docker ubuntu容器更換阿里源(轉)


問題:使用docker 利用下載的ubuntu鏡像啟動容器時,使用的源下載更新軟件的速度較慢。

解決這個問題的方法是跟新ubuntu容器的源

示例:以ubuntu為基礎鏡像

啟動一個名稱為 test02的容器,並且開啟shell交互(/bin/bash )

  docker run -ti --name test02   ubuntu /bin/bash  

用自帶vi修改源

root@e330db11c513:/# vi /etc/apt/sources.list

將原有內容刪除,並替換為以下的阿里源

deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe

更新源

sudo apt-get clean
sudo apt-get update

安裝vim

apt-get install vim


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM