Overview
Multi-Cloud Manager uses Docker Compose to orchestrate both the backend (Flask) and frontend (React) services. This guide walks you through deploying the application using Docker.Prerequisites
- Docker Engine 20.10+
- Docker Compose 2.0+
- Git (to clone the repository)
Project Structure
The application consists of two main services:- Backend: Flask API (Python 3.9)
- Frontend: React application (Node.js 18)
Docker Configuration
Backend Dockerfile
Located atproject/backend/Dockerfile:
Frontend Dockerfile
Located atproject/frontend/Dockerfile:
Docker Compose Configuration
Thedocker-compose.yml file orchestrates both services:
Port Mappings
| Service | Container Port | Host Port | Description |
|---|---|---|---|
| Backend | 5000 | 5000 | Flask API server |
| Frontend | 3000 | 3000 | React development server |
Volume Mounts
Both services use volume mounts for development:- Backend:
./project/backend:/app- Hot reload for Python code changes - Frontend:
./project/frontend:/app- Hot reload for React code changes
Network Configuration
The application uses a custom bridge network (app-network) to enable communication between containers:
- Frontend communicates with backend via proxy:
http://backend:5000 - Both services are isolated from the host network
Running the Application
Step 1: Clone the Repository
Step 2: Set Up Environment Variables
Create a.env file in the root directory. See Environment Variables for all required variables.
Step 3: Build and Start Services
- Build Docker images for both services
- Create the app-network
- Start both containers
- Stream logs from both services
Step 4: Verify Deployment
Once the services are running:- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
Common Docker Commands
Start Services (Detached Mode)
Stop Services
View Logs
Rebuild Services
Restart Services
Execute Commands in Container
View Running Containers
Remove Containers and Volumes
Production Deployment
For production deployments, consider these modifications:Remove Development Volumes
Remove volume mounts fromdocker-compose.yml to use built-in code:
Use Production Build for Frontend
Modifyproject/frontend/Dockerfile for production:
Set Production Environment Variables
Ensure all environment variables are set correctly for production. See Configuration for best practices.Use Docker Secrets
For sensitive credentials, use Docker secrets instead of.env files:
Troubleshooting
Port Already in Use
If ports 3000 or 5000 are already in use, modify the port mappings indocker-compose.yml:
Container Exits Immediately
Check logs for errors:- Missing environment variables
- Dependency installation failures
- Port binding errors
Network Connection Issues
If frontend cannot reach backend:-
Verify both containers are on the same network:
-
Check the proxy configuration in
package.json:
Build Cache Issues
Clear Docker cache and rebuild:Next Steps
- Configure Environment Variables
- Review Configuration Guide
- Set up monitoring and logging for production