Could Not Locate A Flask Application When Creating A Docker Image
I hope someone can help me with this. The following error code comes up when I try and run docker run todolist-docker. WARNING: This is a development server. Do not use it in a
Solution 1:
Is FLASK_APP defined in the docker container? There's no ENV statement in the Dockerfile, and you didn't mention using docker's -e or --env command option. Your container won't inherit your environment variables from the hosting environment.
# syntax=docker/dockerfile:1
FROM python:3.7.8
WORKDIR /tododocker
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
# Add this:
ENV FLASK_APP=App.py
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
Post a Comment for "Could Not Locate A Flask Application When Creating A Docker Image"