使用apt-get在代理之后构build一个docker文件
我试图RUN apt-get -y install python
在代理背后RUN apt-get -y install python
,如下面的dockerfile所示:
FROM ubuntu:16.04 RUN \ http_proxy=http://exampleproxy.com:80 \ apt-get -y update && \ http_proxy=http://exampleproxy.com:80 \ apt-get install -y python python-dev python-pip python-virtualenv RUN \ http_proxy=http://exampleproxy.com:80 \ rm -rf /var/lib/apt/lists/* RUN pip install --upgrade pip --proxy=http://emea-proxy.uk.oracle.com:80 ADD . /code WORKDIR /code RUN pip install -r requirements.txt --proxy=http://exampleproxy.com:80 ENTRYPOINT ["python", "python_file.py"]
我必须在第一次运行中指定两次代理,否则代理不会继续进行apt-get install
。
我不能使用ENV
因为它会影响程序(它运行/获取代理内的文件,如果我将代理指定为环境variables,将会不正确地下载)。
当我尝试build立我的文件时,我得到这个错误:
Unable to fetch some archives, maybe run apt-get update or try with --fix-missing? The command [...]returned a non-zero code: 100
我已经考虑了docker层caching,并在构build映像时使用--no-cache
。 所以apt-get update
应该每次都运行。
谢谢阅读 :)
- 如何在nightwatch.jstesting中自动执行HTTP AUTH PROXY POP UP
- 代理下的boot2docker返回Forbidden
- docker-proxy – 尝试在443上绑定时启动userland代理时出错
- 如何使用代理运行selenium铬节点?
- jwilder / nginx-proxy:无法将ssl与Nginx整合
- Docker-machine:在映像中下载软件包:错误:1解决失败
- angular 5 nginx Docker expressconfiguration不加载mongoose数据
- Docker – 在代理上运行Flask Web应用程序
- WebPageTest代理健康检查和configuration日志