docker build速度慢,通常是外网访问慢,可以通过修改apt-get、pip、npm的源为国内镜像来提高下载速度
1、修改apt-get源
在dockerfile中增加:
RUN mkdir -p /etc/apt RUN touch /etc/apt/sources.list RUN sed -i "s/archive.ubuntu./mirrors.aliyun./g" /etc/apt/sources.list RUN sed -i "s/deb.debian.org/mirrors.aliyun.com/g" /etc/apt/sources.list RUN sed -i "s/security.debian.org\/debian-security/mirrors.aliyun.com\/debian-security/g" /etc/apt/sources.list RUN sed -i "s/httpredir.debian.org\/debian-security/mirrors.aliyun.com\/debian-security/g" /etc/apt/sources.list
2、修改pip install 源
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
3、修改npm源
RUN npm config set registry https://registry.npm.taobao.org