Docker Community Forums

Share and learn in the Docker community.

COPY requirements.txt requirements.txt statement won't work

Hi all.
I’m trying to build python-docker example from Build your Python image | Docker Documentation.
Can’t see what’s wrong.

OS Mac OS x, docker version - 20.10.7

Project structure:

~/projects/python-docker
                  --Dockerfile
                  --app.py
                  --reqiurements.txt

Dockerfile:

# syntax=docker/dockerfile:1
FROM python:3.8-slim-buster
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]

Output:

...
 => CACHED [2/5] WORKDIR /app
 => [internal] load build context
 => => transferring context: 402B
 => ERROR [3/5] COPY requirements.txt requirements.txt
------
 > [3/5] COPY requirements.txt requirements.txt:
------
failed to compute cache key: "/requirements.txt" not found: not found

It seems reqiurements has a typo? So, indeed, "/requirements.txt" not found.

Thanks a lot. Sometimes one extra clear eye is needed.