Docker container giving 404 on every request

40 Views Asked by At

I am dockerizing a Flask app and the docker container is working perfectly but when I try to hit the APIs I get 404 on every request.

This is my docker file

FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt requirements.txt

RUN pip install -r requirements.txt

COPY . .

CMD ["flask", "run", "--host=0.0.0.0"] `

This is my run file

"""module imports""" from api import app if __name__ == "__main__": app.run(host='0.0.0.0',port=5000,debug=False) # add host='----

docker build command: docker build -t my-image .

docker run command: docker container run --env-file .env -it -d -p 5000:5000 my-image

I have already checked the available solutions to this problem but none of them seems to solve it.

0

There are 0 best solutions below