繁体   English   中英

pip 在 Docker 容器中安装失败:没有到主机的路由

[英]pip install fails in Docker container: No route to host

我有一个现有项目,它使用 docker-compose 对所有内容进行了码头化。 它似乎在生产中运行,但我无法让它在我的机器上运行。

Dockerfile我有这些行:

COPY requirements.txt /
RUN pip install -r /requirements.txt

我将requirements.txt安装到本地 virtualenv 中没有问题( pip install -r requirements.txt ),但是当我运行docker-compose up ,它以这个错误结束:

Step 15/21 : RUN pip install -r /requirements.txt
 ---> Running in 50357eef88a5
Collecting django-braces==1.13.0 (from -r /requirements.txt (line 2))
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7efe808852e8>: Failed to establish a new connection: [Errno 113] No route to host'))': /simple/django-braces/
  [THE LINE ABOVE REPEATS 3 MORE TIMES..]
  ERROR: Could not find a version that satisfies the requirement django-braces==1.13.0 (from -r /requirements.txt (line 2)) (from versions: none)
ERROR: No matching distribution found for django-braces==1.13.0 (from -r /requirements.txt (line 2))
ERROR: Service 'api' failed to build: The command '/bin/sh -c pip install -r /requirements.txt' returned a non-zero code: 1

重复行的结尾让我有点困惑:

No route to host'))': /simple/django-braces/

我知道如果它尝试“urls” ))/simple/django-braces/会失败

requirements.txt对我来说也很好。 这是前几行:

# Django packages
django-braces==1.13.0
django-cors-headers==2.4.0
django-extensions==2.1.3
django-filter==2.0.0

有人知道这里发生了什么吗?

好的,找到了。

Dockerfile中有一个旧的代理定义,必须删除。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM