A containerized Flask application with PostgreSQL database demonstrating database integration.
- Flask web framework with PostgreSQL
- Environment-based database configuration
- Persistent PostgreSQL data
- Health check endpoints
- Production-ready setup
docker-flask-postgres/
βββ web/
β βββ Dockerfile
β βββ requirements.txt
β βββ app.py
βββ docker-compose.yml
βββ k8s/
β βββ postgres-deployment.yaml
β βββ postgres-service.yaml
β βββ web-deployment.yaml
β βββ web-service.yaml
βββ README.md
# Clone and run
git clone https://github.com/atulkamble/docker-flask-postgres.git
cd docker-flask-postgres
docker compose up -d
# Test the application
curl http://localhost:5001
# Test database connection
curl http://localhost:5001/health
- Web Port: 5001
- Database: PostgreSQL 16
- Environment Variables: PGHOST, PGUSER, PGPASSWORD, PGDATABASE
Docker Hub: atuljkamble/docker-flask-postgres-web
GitHub: atulkamble/docker-flask-postgres