Skip to content

hasannader2040/Flask_Web_deployment_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Flask_Web_deployment_docker

// adding a photo

3

Flask Web Deployment with Docker

Overview

Flask Web Deployment with Docker is a project that demonstrates how to deploy a Flask web application using Docker. The main goal of this project is to provide a containerized environment for a Flask application, ensuring consistency across development, testing, and production environments. Docker is used to package the application along with all its dependencies, making it easier to run on any system that supports Docker.

Purpose

The purpose of this project is to show how a simple Flask web application can be containerized and deployed using Docker. This approach solves common issues related to environment configuration and dependency management, allowing for smooth deployment across different platforms.

Features

  • Containerized Flask Application: The application runs inside a Docker container, ensuring the same environment everywhere it is deployed.
  • Easy Deployment: With Docker, deploying the Flask application is straightforward and reproducible.
  • Cross-Platform Compatibility: Docker containers can run on any platform that supports Docker, making the deployment process platform-independent.

Getting Started

Prerequisites

Before you start, ensure you have the following installed:

  • Docker: Docker should be installed and running on your machine. You can download Docker from the official website.
  • Git: Git is required to clone the repository. You can install Git from the official website.

Installation

Follow these steps to set up and run the project locally:

  1. Clone the repository:

    git clone https://github.com/hasannader2040/Flask_Web_deployment_docker.git

``

2- Navigate to the project directory:

cd Flask_Web_deployment_docker

Build the Docker image:

docker build -t flask-docker-app .

This command will create a Docker image named flask-docker-app based on the instructions in the Dockerfile.

Running the Application To run the Docker container, use the following command:

docker run -p 5000:5000 flask-docker-app

The -p 5000:5000 flag maps port 5000 inside the Docker container to port 5000 on your local machine. You can access the Flask web application by navigating to http://localhost:5000 in your web browser.

Usage

Here are some examples of how to use the Flask Web Application with Docker:

1- Access the Flask Web Application:

Open a web browser and navigate to:

http://localhost:5000

You should see the homepage of the Flask application.

2- Stopping the Docker Container:

To stop the running container, you can press CTRL + C in the terminal where the Docker container is running. Alternatively, use the following commands:

docker ps  # List running containers to get the container ID
docker stop <container_id>

3- Removing the Docker Container:

After stopping the container, you can remove it using:

docker rm <container_id>

This step is optional but helps to clean up your Docker environment.

Tools and Technologies

This project utilizes the following tools and technologies:

Flask: A lightweight WSGI web application framework in Python. Docker: To create, deploy, and run the Flask application inside containers. Python: The core language used for developing the Flask application.

Contributing

Contributions are welcome! If you'd like to contribute, please follow these steps:

1- Fork the repository. 2- Create a new branch (git checkout -b feature/your-feature-name). 3- Make your changes and commit them (git commit -m 'Add some feature'). 4- Push to the branch (git push origin feature/your-feature-name). 5- Open a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Creating A Simple Web Application (Python, Flask and Redis Database) Using Docker Compose.

• The application utilizes the Flask Python framework to build a web application that counts the number of visits to a website. • Redis database is used for the database tier to keep track of the the counter

About

Creating A Python Flask Web Application With A Redis Database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages