DEV Community

Cover image for From Manual Deployment to Docker Compose
Muhammad Usman
Muhammad Usman

Posted on

From Manual Deployment to Docker Compose

From No Docker → Docker → Dockerfile → Docker Compose

If you're building a multi-tier application (Frontend + Backend + Database), it's VERY important to understand how Docker evolved step-by-step.

This article explains it in the simplest way possible, so you never forget.


1. WITHOUT DOCKER — Everything Is Manual

When you don’t use Docker:

You install everything yourself:

  • Install Node.js
  • Install Python
  • Install PostgreSQL
  • Install all dependencies manually
  • Run each app manually

Commands look like:

npm start        # frontend
python app.py    # backend
postgres server  # database
Enter fullscreen mode Exit fullscreen mode

❌ Problems

  • Hard to set up on a new machine
  • “Works on my machine” issues
  • Version mismatch
  • No isolation
  • Not portable
  • Very hard to deploy to a server

✅ This is the old, messy way.


2. WITH DOCKER (But Without Dockerfile)

Now you use Docker images directly.

Example:

docker pull node
docker pull python
docker pull postgres
Enter fullscreen mode Exit fullscreen mode

Then you:

  • Start a container
  • Copy your code inside
  • Install dependencies manually inside container

❌ Problems

  • Still not automated
  • Repeated manual work
  • Hard to maintain
  • No standard packaging of your app

✅ Better than before, but not a real solution.


3. WITH DOCKERFILE — Packaging Your App

Now you automate everything using a Dockerfile.

Example (Frontend):

FROM node:20
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
Enter fullscreen mode Exit fullscreen mode

You build the image:

docker build -t frontend .
Enter fullscreen mode Exit fullscreen mode

Run it:

docker run -p 3000:3000 frontend
Enter fullscreen mode Exit fullscreen mode

✅ Benefits

  • Fully automated app packaging
  • No manual dependency installation
  • Reproducible environment
  • Runs the same everywhere

❌ But still missing:

  • You run containers manually
  • No networking between frontend, backend, db
  • No startup order
  • No volumes
  • Harder for multi-tier apps

4. DOCKER COMPOSE — The Final, Best Way

Now comes the magic ✨

Create docker-compose.yml in your project root.

Define all three services:

✅ Frontend
✅ Backend
✅ PostgreSQL database

Example:

version: "3.9"

services:
  frontend:
    build: ./frontend
    ports:
      - "3000:3000"
    depends_on:
      - backend

  backend:
    build: ./backend
    ports:
      - "5000:5000"
    environment:
      - DB_HOST=db
      - DB_USER=postgres
      - DB_PASSWORD=123456
      - DB_NAME=postgres
    depends_on:
      - db

  db:
    image: postgres:14
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: 123456
      POSTGRES_DB: postgres
    ports:
      - "5432:5432"
    volumes:
      - db_data:/var/lib/postgresql/data

volumes:
  db_data:
Enter fullscreen mode Exit fullscreen mode

Now you start EVERYTHING with ONE command:

docker-compose up -d
Enter fullscreen mode Exit fullscreen mode

✅ Docker Compose gives you:

  • Builds images automatically
  • Starts all containers
  • Creates private network
  • Connects services together
  • Maintains volumes (persistent database)
  • Runs containers in correct order
  • Clean logs & easy debugging

This is the modern, professional, and production-ready way to run multi-tier apps.


✅ Conclusion

Once you understand these four steps, Docker becomes EASY — and you can confidently build any 3-tier application.

If you want to continue learning DevOps step-by-step, you can follow me here:

🔗 YouTube
🔗 Website
🔗 Apps

No matter how small the progress is, every step counts.
Thank you for reading! 🚀

Top comments (0)