Добавить
Уведомления

How to build Docker Images for a Flask App

I walk through how to Dockerize an existing Python Flask web application by creating the Dockerfile and running the appropriate commands. Link to public Github repo: https://github.com/vastevenson/docker-flask-test Here are the steps: Create a Flask app Confirm the flask app can run Add a Dockerfile to the src dir Run command from terminal: docker image build -t docker-flask-test . (don’t miss the last .) Run command: docker run -p 5000:5000 -d docker-flask-test Note: we are binding the host port 5000 to the container port 5000. We are also running in detached mode so the terminal shows up in separate window and naming the container. You will see the container ID appear, you can see the logs by typing in: docker container logs [Image ID] docker container stop [ID] will stop the container docker system prune will remove any stopped containers, unused volumes and networks, and dangling images. Special thanks to Tasnuva Zaman: https://medium.com/@tasnuva2606/dockerize-flask-app-4998a378a6aa

Иконка канала Введение в Python
4 подписчика
12+
16 просмотров
2 года назад
12+
16 просмотров
2 года назад

I walk through how to Dockerize an existing Python Flask web application by creating the Dockerfile and running the appropriate commands. Link to public Github repo: https://github.com/vastevenson/docker-flask-test Here are the steps: Create a Flask app Confirm the flask app can run Add a Dockerfile to the src dir Run command from terminal: docker image build -t docker-flask-test . (don’t miss the last .) Run command: docker run -p 5000:5000 -d docker-flask-test Note: we are binding the host port 5000 to the container port 5000. We are also running in detached mode so the terminal shows up in separate window and naming the container. You will see the container ID appear, you can see the logs by typing in: docker container logs [Image ID] docker container stop [ID] will stop the container docker system prune will remove any stopped containers, unused volumes and networks, and dangling images. Special thanks to Tasnuva Zaman: https://medium.com/@tasnuva2606/dockerize-flask-app-4998a378a6aa

, чтобы оставлять комментарии