I’m encountering a problem with a Docker build process, and I’m seeking assistance to diagnose and resolve the issue.
I have a Dockerfile and a
requirements.txt file in the same directory. However, when I attempt to build the Docker image using the
docker build command, I receive the following error:
ERROR [4/4] RUN pip install -r requirements.txt: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
I’ve tried various troubleshooting steps, including confirming the directory structure, file permissions, filename case sensitivity, and using the
--no-cache option, but the problem persists.
# Use an official Python runtime as a parent image FROM python:3.8 # Set the working directory WORKDIR /template_automating_in_aws # Copy the current directory contents into the container at /app COPY . /app # Install the required packages specified in requirements.txt RUN pip install -r requirements.txt # Make port 80 available to the world outside this container EXPOSE 80 # Define environment variable ENV KEY password_easy # Run app.py when the container launches CMD ["python", "app.py"]
- Checked file permissions for
- Confirmed directory structure.
- Checked for
.dockerignoreexclusions. (I don´t create ones)
- Ensured correct context for
- Restarted the computer.
- Tried building with
- OS: Macbook Air 16GB
- Docker Version: 24.0.6
If anyone has encountered a similar issue or has any insights into what might be causing this error, I would greatly appreciate any help and guidance to resolve it.
Thank you in advance for your assistance.