1. 程式人生 > >dockerfile debian 和pip使用國內源

dockerfile debian 和pip使用國內源

python官方映象是基於debian的。國內使用時定製一下,加快下載速度。

1 debian本身使用國內源

dockfile中:

#國內debian源 ADD sources.list /etc/apt/
sources.list在dockerfile同目錄下:

deb http://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib
deb http://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib
deb http://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ stretch main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian/ stretch-backports main non-free contrib
deb http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib
deb-src http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib

2 pip使用國內源

#用國內源加速大包的安裝 COPY pip.conf /etc/pip.conf

pip.conf

[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple