docker集装箱内的pip安装下载速度非常慢

在从dockerfile创buildDocker镜像或者创build容器时,在conda环境下pip install <package>速度非常慢。

如果没有docker的话,下载速度会有很大的不同。 我试图改变镜像pip install -i http:pypi.doubanio.com/simple <package> ,并且可以获得轻微的改进,但在pip install -i http:pypi.doubanio.com/simple <package>内部和外部仍然不同。 通过curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -testing容器内的下载速度curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python - curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -给我预期好的结果。

我build议在运行--network host构build时使用--network host来构build。 这将保证RUN指令直接使用主机networking。 这样你就可以确定,缓慢与docker无关。