dockerfile debian 和pip使用國內源

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

1 debian自己使用國內源

dockfile中:docker

#國內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 contriburl

2 pip使用國內源

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

pip.confip

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple 
相關文章
相關標籤/搜索