DEV Community

Cover image for Multi-Container Web Application with Nginx Reverse Proxy and Docker Compose
Bala Audu Musa
Bala Audu Musa

Posted on

Multi-Container Web Application with Nginx Reverse Proxy and Docker Compose

This project demonstrates a production-style multi-container architecture using Docker Compose, where a Node.js application is deployed behind an Nginx reverse proxy.

The goal of this project is to showcase real DevOps patterns, not single-container demos.

πŸš€ What This Project Demonstrates

  • Multi-container application design
  • Docker Compose for service orchestration
  • Nginx as a reverse proxy
  • Private application containers (not exposed to the internet)
  • Service-to-service communication via Docker networking
  • Clean separation between application and web server
  • Production-ready container structure

🧱 Architecture Overview

Client (Browser)
|
v
Nginx (public, port 8080)
|
v
Node.js App (private, port 5000)

  • Only Nginx is exposed to the host
  • The Node.js app is accessible only inside the Docker network
  • Containers communicate using service names, not IPs

πŸ“ Project Structure

project-2-multicontainer/
β”œβ”€β”€ app/
β”‚ β”œβ”€β”€ Dockerfile
β”‚ β”œβ”€β”€ index.js
β”‚ β”œβ”€β”€ package.json
β”‚ └── package-lock.json
β”œβ”€β”€ nginx/
β”‚ └── nginx.conf
β”œβ”€β”€ docker-compose.yml
└── README.md


βš™οΈ Technologies Used

  • Docker
  • Docker Compose (v2)
  • Node.js (Express)
  • Nginx
  • Linux-based containers

πŸ›  How to Run the Project Locally

Prerequisites

  • Docker Desktop
  • Docker Compose v2

Steps

  1. Clone the repository:
git clone https://github.com/dr-musa-bala/project-2-multicontainer.git
cd project-2-multicontainer

2. **Build and start the containers**:

Enter fullscreen mode Exit fullscreen mode

docker compose up --build


3. Open your browser:

Open your browser:

Enter fullscreen mode Exit fullscreen mode

localhost:8080




![ ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1i3isd39y65f8rc0ttbv.png)

πŸ”’ **Security & Production Considerations**

The application container does not expose any ports to the host

All external traffic is handled by **Nginx**

This mirrors how applications are deployed in real production environments

πŸ’‘ **Why This Matters (DevOps Perspective)**

This project reflects how modern DevOps teams:

- Isolate application services
- Control ingress traffic via reverse proxies
- Use declarative configuration for reproducibility
- Build systems that are easy to extend into CI/CD pipelines

πŸ”œ **Next Improvements**

- Add CI/CD with GitHub Actions
- Push application images to Docker Hub
- Deploy the stack to AWS EC2
- Implement zero-downtime updates
- Add HTTPS with Let’s Encrypt






Enter fullscreen mode Exit fullscreen mode

Top comments (0)