teoman
teoman

Reputation: 969

Docker wants a requirement file even though I do not want it to?

I had a dockerfile with this commands in it:

#base image
FROM python:3-onbuild



WORKDIR /app

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

.. and then when I tried the build the image;

sudo docker build -t helloeveryone .

I had this problem:

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

Even though I did not specify a requirements.txt in my Dockerfile.

What is the problem?

Upvotes: 2

Views: 760

Answers (1)

bgse
bgse

Reputation: 8587

The problem is you are using a base image that expects and automatically feeds a requirements.txt file to pip.

If you do not want this, you should select a different base image, e.g. change your dockerfile:

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

WORKDIR /app
ADD . /app

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

Upvotes: 2

Related Questions