Deploy Flask app using docker Compose

rajnishspandey

Rajnish

Posted on November 2, 2024

Deploy Flask app using docker Compose

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
Docker Images

Docker Containers
Docker Containers

Running flask Application
This UI can be different as it's possible that the code is updated
Running Application

Learn how to

- From Setup to Deployment: Running a Flask App in Docker

- Share docker image on docker hub

"Happy Learning"

Buy me a coffee

some useful docker commands

  • docker images to check all the images
  • docker build -t <new-image-name>-app . to build an images from your application
  • docker image rm <image-name> - to delete image which is not in use
  • docker run -it --name <new_container> <base-image> /bin/bash to create a new container and run it from base image. (here above we had python as base image)
  • docker image rm <image-name> -f delete image which is in use forcefully
  • docker ps -a to see all the containers running
  • docker container rm <container-name> to delete container which is not running
  • docker container rm <container-name> -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
💖 💪 🙅 🚩
rajnishspandey
Rajnish

Posted on November 2, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Share docker image on docker hub
webdev Share docker image on docker hub

November 2, 2024