Docker错误:由于Oserror而无法安装软件包:[Errno 2]

发布于 2025-02-10 12:10:02 字数 597 浏览 2 评论 0原文

大家好,当我尝试Docker Image build -t Py -Test

错误:由于Oserror而无法安装软件包:[ERRNO 2]没有这样的文件或目录:'// tmp/tmp_ohy_f6g/output.json'

执行人失败运行[/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版本: docker版本20.10.16,构建AA7E41414141414141414

MacOS(Localhost)版本 - MacOS Montery版本12.4(21F79)

hey guys getting this error when i try to 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'

executor failed running [/bin/sh -c pip install ibm-db]: exit code: 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

macOS (localhost) version -- macos montery version 12.4 (21F79)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

娇纵 2025-02-17 12:10:02

使用pip以详细模式运行构建(pip install -v ibm-db)后,您可以看到以下错误:

No Gcc installation detected.
Please install gcc and continue with the installation of the ibm_db.

ibm-db要求您在安装它时具有可用的GCC,以便您可以构建其C模块。

安装gcclibc-dev ibm-db解决问题:

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"]

After running the build with pip in verbose mode (pip install -v ibm-db), you can see the following error:

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.

Installing gcc and libc-dev before ibm-db solves the issue:

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"]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文