kubernetes - DockerInDocker:在 docker 镜像构建时 pip install 失败
问题描述
我正在开发一个安装了 Istio 的 Kubernetes 集群,并且我正在使用docker:dind
pod 上的映像来动态构建 docker 映像。问题是,一旦构建阶段到达RUN pip install numpy
我的 Dockerfile ,它就会失败并抛出以下错误:
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
ERROR: Could not find a version that satisfies the requirement numpy (from versions: none)
ERROR: No matching distribution found for numpy
用于测试的 Dockerfile:
FROM python:3.7.7-slim-buster
RUN pip install numpy
CMD ["echo", "Testing..."]
包含docker:dind
图像的 pod 能够安装 Python 包,执行:
/ # apk add python3 py3-pip
/ # pip install numpy
Collecting numpy
Downloading numpy-1.19.0.zip (7.3 MB)
|████████████████████████████████| 7.3 MB 1.4 MB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
...
有效(实际上由于构建依赖关系而失败,但它可以连接到 pypi),但执行以下操作:
/ # cd tmp/
/ # vi Dockerfile # Set the content as described above
/ # docker build .
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM python:3.7.7-slim-buster
3.7.7-slim-buster: Pulling from library/python
8559a31e96f4: Pull complete
62e60f3ef11e: Pull complete
286adfd1ee25: Pull complete
8973789a3a6b: Pull complete
9b8d369425a7: Pull complete
Digest: sha256:5b25848c082804c500e8cadce6d1b344791aa39d82cb9d56285c65e3e937f0c2
Status: Downloaded newer image for python:3.7.7-slim-buster
---> 4cbd5021babc
Step 2/3 : RUN pip install numpy
---> Running in 0496b1cfcbb0
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))': /simple/numpy/
ERROR: Could not find a version that satisfies the requirement numpy (from versions: none)
ERROR: No matching distribution found for numpy
简直失败了……
我想知道是否有人遇到过这样的事情并能够解决它。
提前致谢。:)
解决方案
推荐阅读
- python-3.x - 将 spacy 预训练模型下载添加到 yml 文件
- core-data - CloudKit JS 反序列化 [Double] 可转换类型数据
- c# - 我正在尝试制作一个提交类型按钮,当单击该按钮时,会将用户重定向到另一个 Razor 类型页面
- python - 如何从数据框中的日期时间列中查找日期范围?
- c++ - 在迭代容器时更改容器元素的惯用方式
- python - Python:排列
- sql - 如何解决 SQL Server 数据库连接字符串 (ASP.NET) 中的 proivder 错误
- matlab - 在现有 CSV 文件的末尾追加新行
- python - dnspython:如何以字节形式获得响应
- javascript - 单击按钮时清除输入文本