python – 在代理下的dockerfile中的pip
发布时间:2020-05-25 05:46:38 所属栏目:Python 来源:互联网
导读:我正在尝试为elasticsearch-curator构建一个Docker镜像, 这是dockerfile: FROM alpine:3.7RUN adduser -S curatorRUN apk add --update python python-dev py-pip build-base pip install virt
|
我正在尝试为elasticsearch-curator构建一个Docker镜像, 这是dockerfile: FROM alpine:3.7
RUN adduser -S curator
RUN apk add --update
python
python-dev
py-pip
build-base
&& pip install virtualenv
&& pip install elasticsearch-curator
&& rm -rf /var/cache/apk/*
USER curator
ENTRYPOINT [ "/usr/bin/curator"]
事情是我在代理下,所以我必须建立我的形象: docker build --no-cache --build-arg HTTP_PROXY=http://xx.xx.xx.xx:xx -t elasticsearch-curator:5.4 . 但是当它想要获得virtualenv时,我得到: Collecting virtualenv Retrying (Retry(total=4,connect=None,read=None,redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8259ed350>,'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/virtualenv/ Retrying (Retry(total=3,redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb8259ed210>,'Connection to pypi.python.org timed out. (connect timeout=15)')': /simple/virtualenv/ 我找到了解决插入问题的人 ENV http_proxy http://proxy-chain.xxx.com:911/ ENV https_proxy http://proxy-chain.xxx.com:912/ 在Dockerfile中,但我不可能,因为我的代理仅在我的建筑物上有效,所以如果来自其他地方的另一个人想要构建图像,他将需要从Dockerfile中删除http_proxy env var. 有没有其他方法可以实现它?这似乎是一个非常常见的用例…… 解决方法我通过在命令行中添加HTTPS_PROXY来解决它:docker build --no-cache --build-arg HTTP_PROXY=http://xx.xx.xx.xx:xx --build-arg HTTPS_PROXY=http://xx.xx.xx.xx:xx -t elasticsearch-curator:5.4 . (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
