This project demonstrates how to design, containerize and deploy a web application using Docker.
- Backend API: Node.js + Express
- Database: PostgreSQL
- Orchestration: Docker Compose
- Networking: Docker Macvlan
- Storage: Docker Named Volume
Client (Browser / Postman) ↓ localhost:3000 (Port Mapping) ↓ Docker Host ↓ Docker Bridge Network (172.18.0.0/16) ↓ Backend Container (Node.js + Express) ↓ PostgreSQL Container ↓ Docker Volume (Persistent Storage)
container-project/ ├── backend/ │ ├── Dockerfile │ ├── package.json │ ├── package-lock.json │ ├── server.js │ └── node_modules/ ├── database/ │ ├── Dockerfile │ └── init.sql ├── docker-compose.yml ├── .dockerignore └── README.md
docker network create -d macvlan \ --subnet=192.168.1.0/24 \ --gateway=192.168.1.1 \ myymacvlan
docker-compose up -d
docker ps
curl http://localhost:3000/users
curl -X POST http://localhost:3000/add \
-H "Content-Type: application/json"
-d '{"name": "Lakshita"}'
curl http://localhost:3000/users
sudo docker ps
docker network inspect mymacvlan
docker images
docker volume ls
Step 1 — Insert Data curl -X POST http://localhost:3000/add Step 2 — Retrieve Data curl http://localhost:3000/users Step 3 — Stop Containers docker-compose down Step 4 — Restart Containers docker-compose up -d Step 5 — Verify Persistence curl http://localhost:3000/users
This project presents the design, containerization, and deployment of a multi-container web application using Docker and Docker Compose, demonstrating fundamental DevOps and containerization principles. The system consists of a Node.js and Express backend service integrated with a PostgreSQL database, each running in isolated containers to ensure modular architecture and service independence. Docker Compose is utilized for service orchestration and dependency management, while Docker networking enables seamless inter-container communication. Additionally, Docker named volumes are implemented to provide persistent storage, ensuring that database data remains intact across container restarts. The project further validates container functionality through API testing and verification of running containers, networks, images, and volumes, thereby illustrating practical concepts such as container lifecycle management, environment configuration, data persistence, and scalable application deployment within a containerized environment.