Deploy Flask app using docker Compose

Rajnish - Nov 2 - - Dev Community

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
. . . .
Terabox Video Player