Skip to content

VishAstra/Containerize_flask-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Docker Application

###This repository contains a simple Flask application with Dockerfile to containerize it.

Instructions **

Prerequisites

  • Docker installed on your machine(scroll down to see the instruction to install docker
  • Docker Hub account (for image registry)

Building Image

  1. Clone this repository
git clone https://github.com/VishAstra/flask-hello-app.git 
  1. Navigate to the repository directory
cd flask-hello-app 
  1. Build the Docker image from the Dockerfile

Copy code

docker build -t my-flask-app . 
  1. Once built, verify the image is created

Copy code

docker images 

You should see the my-flask-app image listed.

  1. Running Container To run the Flask app container:
docker run -p 8080:8080 my-flask-app The app will be available at [http://localhost:8080]

Pushing Image to Docker Hub To share the image on Docker Hub:

6.Log into Docker CLI

docker login 
  1. Tag image with Docker Hub username
docker tag my-flask-app /my-flask-app 
  1. Push image
docker push /my-flask-app

The image is now available publicly on Docker Hub.

Deploying to Cloud Use Docker Hub integration in your cloud platform (AWS ECS, GCP Run etc) to deploy the containerized Flask app. This allows running the application at scale.

🔚-------------------------------------------------------------------------------------------------------------------------------------------------------------- Here are the steps to install Docker on some common operating systems, including Amazon Linux on AWS EC2:

Ubuntu/Debian

sudo apt update
sudo apt install docker.io

CentOS/RHEL/Amazon Linux

sudo yum update
sudo yum install docker

Fedora

sudo dnf update
sudo dnf install docker-ce

MacOS

Download and install Docker Desktop from docker.com

Windows 10/11

Download and install Docker Desktop from docker.com

AWS EC2 Amazon Linux

sudo yum update -y
sudo yum install docker -y
sudo service docker start

Verify Installation

Check Docker version:

docker --version

Run a test container:

docker run hello-world

About

simple flask app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors