This document explains how to set up the complete Greenstagram development environment using Docker and Docker Compose.
- Docker Desktop installed and running
- Docker Compose (included with Docker Desktop)
- Git
Make the startup script executable chmod +x start-dev.sh Start the complete development environment ./start-dev.sh
- Copy environment files cp backend/.env.example backend/.env cp frontend/.env.example frontend/.env # if exists
- Start all services docker-compose up --build -d
- Check service health docker-compose ps
| Service | Port | Description |
|---|---|---|
| Frontend | 3000 | React development server |
| Backend | 5000 | Node.js API server |
| MongoDB | 27017 | Database |
| Redis | 6379 | Cache & session storage |
- URL:
mongodb://admin:password123@localhost:27017/greenstagram - Username:
admin - Password:
password123 - Database:
greenstagram
- URL:
redis://:redis123@localhost:6379 - Password:
redis123
View logs for all services docker-compose logs -f View logs for specific service docker-compose logs -f backend Restart a service docker-compose restart backend Stop all services docker-compose down Complete cleanup (removes volumes) docker-compose down -v Rebuild and restart docker-compose up --build --force-recreate
- Start Environment:
./start-dev.shordocker-compose up -d - Make Changes: Edit code in
frontend/orbackend/directories - View Changes: Changes are automatically reflected (hot reload)
- Check Logs:
docker-compose logs -f [service-name] - Stop Environment:
docker-compose down
If you get port conflict errors:
Check what's using the ports lsof -i :3000 lsof -i :5000 lsof -i :27017 lsof -i :6379 Kill conflicting processes kill -9
Reset database completely docker-compose down -v docker-compose up --build -d
Fix file permissions chmod +x start-dev.sh sudo chown -R $(whoami) .
When contributing to this project:
- Ensure Docker environment works:
./start-dev.sh - Test your changes in the containerized environment
- Update this documentation if you modify Docker configuration
- Include Docker-related changes in your PR
This Docker setup resolves Issue #21: "Containerize backend with Redis and MongoDB for easy development"
✅ Single command startup (docker-compose up )
✅ Consistent development environment
✅ Eliminates manual MongoDB/Redis setup
✅ Version consistency across all developers
✅ Simplified onboarding for new contributors
This containerization setup significantly improves the developer experience and addresses the key pain points mentioned in the issue.