gpt4 book ai didi

python - Docker 想要一个需求文件,尽管我不想要它?

转载 作者:太空宇宙 更新时间:2023-11-03 13:58:06 25 4
gpt4 key购买 nike

我有一个 dockerfile,其中包含以下命令:

#base image
FROM python:3-onbuild



WORKDIR /app

ADD . /app
#run the application
CMD ["python", "helloeveryone.py"]

..然后当我尝试构建图像时;

sudo docker build -t helloeveryone .

我遇到了这个问题:

Sending build context to Docker daemon  3.072kB
Step 1/3 : FROM python:3-onbuild
# Executing 3 build triggers
COPY failed: stat /var/lib/docker/tmp/docker-
builder656900257/requirements.txt: no such file or directory

即使我没有在 Dockerfile 中指定requirements.txt。

问题是什么?

最佳答案

问题是您正在使用 base image that expects and automatically feeds a requirements.txt file to pip .

如果您不希望这样,您应该选择不同的基础镜像,例如更改你的dockerfile:

FROM python:3 # or python:3-slim, python:3-alpine or other suitable image

WORKDIR /app
ADD . /app

CMD ["python", "helloeveryone.py"]

关于python - Docker 想要一个需求文件,尽管我不想要它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49463158/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com