A minimal Python Flask web application containerized with Docker and orchestrated using Docker Compose. The application demonstrates a simple hit counter stored in Redis, showcasing backend + DevOps fundamentals.
This project demonstrates how to build, containerize, and deploy a Flask web application using Docker. It uses Redis as a backend service to store a hit counter and shows how multiple services communicate using Docker Compose.
The project is beginner-friendly and suitable for learning:
- Flask basics
- Docker & Docker Compose
- Service-to-service communication
- Deployment-ready project structure
- Python Flask web application
- Redis used as a hit counter
- Dockerfile for building the application image
- Docker Compose for multi-container orchestration
- Clean project structure with screenshots for documentation
- Python
- Flask
- Redis
- Docker
- Docker Compose
- Git & GitHub
deploy-webApplication-python-flask/
├── app.py
├── requirements.txt
├── Dockerfile
├── docker-compose.yaml
├── README.md
└── screenshot/
Shows Flask source code and Docker configuration (click to enlarge):
Output and container screenshots:
docker image lsdocker psSequence showing the hit counter incrementing in the browser:
- Docker (Engine)
- Docker Compose
- Optional: Python 3.9+ for local development
From the project root (where docker-compose.yaml exists):
docker-compose up --buildOpen your browser:
http://localhost:3000
To stop and remove containers:
docker-compose downpython -m venv .venv
# Windows PowerShell
.venv\Scripts\Activate
pip install -r requirements.txt
python app.pyThe app will be available at:
http://localhost:5000
| Variable | Default | Description |
|---|---|---|
| FLASK_DEBUG | false | Enable Flask debug mode |
| REDIS_HOST | redis | Redis service name (Docker Compose) |
| REDIS_PORT | 6379 | Redis port |
Docker Compose maps:
Host: 3000 → Container: 5000
For rapid development:
docker-compose upCode changes are reflected immediately when using volumes (if enabled). Unit tests can be added later using pytest.
-
Redis connection issue
docker-compose ps docker logs my-container_redis
-
Port 3000 already in use Change the host port mapping in
docker-compose.yaml.
- Fork the repository
- Create a feature branch
git checkout -b feat/your-feature- Commit your changes and open a Pull Request
Belal Mahmoud DevOps Engineer
- GitHub: https://github.com/Belal2015
- LinkedIn: https://www.linkedin.com/in/belal-mahmoud-devops/
- Email: belalmahmoud8183@gmail.com
This project is licensed under the MIT License. See the LICENSE file for details.
d1cf437 (add README.md)






