docker run -it --rm -e FLASK_APP=my_flask_app.py -v "$PWD:/app" -p 5000:5000 craigrhodes/flask
Be sure to replace my_flask_app.py with the actual name of your main python file.
Your application is now visible at localhost:5000 and your.ip.address:5000.
In production, build an image from this image copying your source code into the /app directory inside the image instead of mounting the project directory as a volume.
FROM alpine ENV FLASK_APP=app.py RUN apk add --no-cache python3 RUN ln -s `which python3` /usr/local/bin/python && ln -s `which pip3` /usr/local/bin/pip RUN pip install flask EXPOSE 5000 WORKDIR /app CMD ["flask", "run", "-h", "0.0.0.0"]
Content type
Image
Digest
Size
21.2 MB
Last updated
about 9 years ago
docker pull craigrhodes/flask