我有一个包含此命令的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。
有什么问题?
答案 0 :(得分:1)
问题是您使用的是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"]