【发布时间】:2021-11-15 10:45:20
【问题描述】:
我正在使用 requirements.txt 文件构建 Docker 映像。每次我构建映像时,由于某些软件包版本不存在,它总是失败。例如
ARG BASE_CONTAINER=tensorflow/tensorflow
FROM $BASE_CONTAINER
# 2) change to root to install packages
USER root
COPY requirements.txt requirements.txt
# 3) install packages
RUN pip install -r requirements.txt
ERROR: Could not find a version that satisfies the requirement msrestazure==0.5.4
(from -r requirements.txt (line 66)) (from versions: 0.0.1, 0.0.2, 0.1.0, 0.1.1, 0.1.2,
0.2.0, 0.2.1, 0.3.0, 0.4.0rc1, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.7,
0.4.8, 0.4.9, 0.4.10, 0.4.11, 0.4.12, 0.4.13, 0.4.14, 0.4.15, 0.4.16, 0.4.17, 0.4.18,
0.4.19, 0.4.20, 0.4.21, 0.4.22, 0.4.23, 0.4.24, 0.4.25, 0.4.26, 0.4.27, 0.4.28, 0.4.29,
0.4.30, 0.4.31, 0.4.32, 0.4.33, 0.4.34, 0.5.0, 0.5.1, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4)
#6 9.178 ERROR: No matching distribution found for msrestazure==0.5.4 (from -r requirements.txt (line 66))
为了解决这个问题,我刚刚将我的 requirements.txt 中的包版本更改为 docker 可以找到的最新版本。我想知道是否有办法以编程方式执行此操作。如果我的 requirements.txt 文件中的版本不存在/找不到,我可以使用一些标志或选项来自动安装 docker 可以找到的最新版本的软件包吗?
【问题讨论】:
标签: python docker installation pip requirements.txt