Home > Backend Development > Python Tutorial > Deploy Flask app using docker Compose

Deploy Flask app using docker Compose

Barbara Streisand
Release: 2024-11-03 04:58:30
Original
246 people have browsed it

Docker compose

  • Compose simplifies the control of your entire application stack, making it easy to manage services, networks, and volumes in a single, comprehensible YAML configuration file. Then, with a single command, you create and start all the services from your configuration file

To learn more about Docker images, containers and basic Flask app deployment on docker read blog

In this blog we are going to deploy our flask application on Docker using docker compose file.

how to clone, create, deploy everything is already covered here please read and follow the instructions or you can just start by

git clone https://github.com/rajnishspandey/productivity.git

  • docker system prune -a to delete all existing containers, images and caches.

docker compose up

Docker Images
Deploy Flask app using docker Compose

Docker Containers
Deploy Flask app using docker Compose

Running flask Application
This UI can be different as it's possible that the code is updated
Deploy Flask app using docker Compose

some useful docker commands

  • docker images to check all the images
  • docker build -t -app . to build an images from your application
  • docker image rm - to delete image which is not in use
  • docker run -it --name /bin/bash to create a new container and run it from base image. (here above we had python as base image)
  • docker image rm -f delete image which is in use forcefully
  • docker ps -a to see all the containers running
  • docker container rm to delete container which is not running
  • docker container rm -f to delete container forcefully which is running
  • docker system prune -a to delete all containers, images and caches.
  • docker compose up to run docker compose file and created image

The above is the detailed content of Deploy Flask app using docker Compose. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template