網(wǎng)上都是通過修改/etc/apt/sources.list再update的方式改源的。可是docker ubuntu鏡像沒有vi編輯器,要先update才可以安裝vim。
官方源的速度太慢了,等半天都沒有update完。有沒有方法快速修改/etc/apt/sources.list呢?其實(shí)是有的:
以下通過正則替換的方式改為阿里的鏡像即可直接 update
sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
apt-get clean
apt-get update -y