Docker Community Forums

Share and learn in the Docker community.

Could not open requirements file

Hi guys,

I am new to Docker and I am trying to build a Python image with the libraries I need. I tried to follow some tutorials online but I did not succeed.

Here is what my docker file looks like. I placed requirements.txt just next to Dockerfile in the same directory.

FROM python:latest
RUN apt-get updat
RUN apt-get install cron -yqq curl
RUN pip install -r requirements.txt
RUN mkdir /data
RUN mkdir /notebooks
RUN mkdir /tmp/tflearn_logs
VOLUME ["/data", “/notebooks”, “/tmp/tflearn_logs”]
CMD jupyter notebook --no-browser --ip= --allow-root --NotebookApp.token=‘demo’

However when I try to build the image it says “Could not open requirements file: [Errno 2] No such file or directory: ‘requirements.txt’”.

Does someone know how to fix my problem ? Or/and has any remark about something useless I do or something useful I forgot in my Dockerfile ?

Thanks for the help


1 Like

Nothing in your Dockerfile COPYs any of your source files into the built image (or ADDs an sdist).

Ok I managed to build the image after copying the requirements.txt file into the image. Thanks for your help.

You need to keep the requirements.text inside the image because pip looks inside the image

Add the following

COPY requirements.txt /tmp
RUN pip install -r requirements.txt

Let me know if it is fixed :slight_smile:


Yes it worked fine! Thanks for the help!

1 Like

It worked for me. Thanks worked for me

Hi just chewing my rut here i checked my typing nd i spelled my files with.text and .txt