Docker Compose

Overview
This project runs a multi-service application using Docker Compose. It connects an application, database, and cache in a single setup, making local development and deployment consistent.
The goal is to ensure all services start together and work in the same environment every time.
Stack
Docker
Docker Compose
Node.js (App)
PostgreSQL
Redis
Architecture
App → Database (PostgreSQL)
App → Cache (Redis)
All services connected via Docker networkStep 1: Dockerfile (App)
FROM node:18-alpine
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]Step 2: Docker Compose File
version: "3"
services:
app:
build: .
ports:
- "3000:3000"
depends_on:
- db
- cache
db:
image: postgres
environment:
POSTGRES_PASSWORD: password
ports:
- "5432:5432"
cache:
image: redis
ports:
- "6379:6379"Step 3: Run Application
docker-compose up -dStep 4: Check Services
docker psResult
App, database, and cache run together
One command starts all services
Same environment for all developers
Easy local testing and setup
Key Points
Simplifies multi-service setup
Removes manual configuration
Ensures consistent environments
Ideal for development and testing
Final Note
This project shows how multiple services can run together using containers.
Instead of managing each service separately, everything is defined and started in one place, making development faster and more reliable.

