[英]docker ERROR: Could not install packages due to an OSError: [Errno 2]
hey guys getting this error when i try to docker image build -t py-test
嘿,当我尝试docker image build -t py-test
时出现此错误
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/tmp/tmp_ohy_f6g/output.json'错误:由于 OSError 无法安装软件包:[Errno 2] 没有这样的文件或目录:'/tmp/tmp_ohy_f6g/output.json'
executor failed running [/bin/sh -c pip install ibm-db]: exit code: 1执行程序运行失败 [/bin/sh -c pip install ibm-db]:退出代码:1
dockerfile:码头文件:
FROM python:3.9.13-alpine3.16
WORKDIR /app
RUN pip install --upgrade setuptools
RUN pip install --upgrade pip
RUN pip install ibm-db
RUN pip install flask
EXPOSE 8080
COPY . .
CMD ["python", "output.py"]
Docker version 20.10.16, build aa7e414 Docker 版本 20.10.16,构建 aa7e414
macOS (localhost) version -- macos montery version 12.4 (21F79) macOS (localhost) 版本——macos montery 版本 12.4 (21F79)
After running the build with pip
in verbose mode ( pip install -v ibm-db
), you can see the following error:在详细模式下使用pip
运行构建后 ( pip install -v ibm-db
),您可以看到以下错误:
No Gcc installation detected.
Please install gcc and continue with the installation of the ibm_db.
ibm-db
requires you to have gcc
available when installing it, so that you can build it's C modules. ibm-db
要求您在安装时提供gcc
,以便您可以构建它的 C 模块。
Installing gcc
and libc-dev
before ibm-db
solves the issue:在ibm-db
解决问题之前安装gcc
和libc-dev
:
FROM python:3.9.13-alpine3.16
WORKDIR /app
RUN apk add gcc libc-dev
RUN pip install --upgrade setuptools
RUN pip install --upgrade pip
RUN pip install ibm-db
RUN pip install flask
COPY . .
EXPOSE 8080
CMD ["python", "output.py"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.