docker中ubuntu容器更换apt源
-
网上主要用改换
/etc/apt/sources.list
再update的方式,在docker新建的ubuntu容器中需先update再更换才能正常使用。 -
以下通过正则替换的方式改为 aliyun 的镜像即可直接 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 clean
apt-get update -y