vanshikamunjal665-containerization-theory.github.io

Containerization Project 🐳

Dockerized Web Application using Node.js + Express + PostgreSQL with Docker Compose and Macvlan Networking.


View Project Report


📁 Project Structure

containerization-project-1
│
├── backend
│   ├── Dockerfile
│   ├── package.json
│   ├── package-lock.json
│   ├── server.js
│   └── .dockerignore
│
├── database
│   └── Dockerfile
│
├── docker-compose.yml
├── project-ss
│   └── screenshots
│
└── README.md

🎯 Objective

The objective of this project is to:


🌐 Step 1: Create Macvlan Network

docker network create \
--driver macvlan \
--subnet 172.30.0.0/24 \
--gateway 172.30.0.1 \
-o parent=eth0 \
lan_net

Macvlan Network Creation


🌐 Step 2: List Docker Networks

docker network ls

Docker Network List


🔍 Step 3: Inspect Macvlan Network

docker network inspect lan_net

Docker Network Inspect


🚀 Step 4: Build and Start Containers

docker-compose up --build

Docker Compose Logs Docker Compose Logs

This confirms that the backend and PostgreSQL containers start successfully.


🐳 Step 5: Check Running Containers

docker ps

Running Containers

Running containers:


🌐 Step 6: Inspect Docker Compose Network

docker network inspect containerization-project-1_default

Network Inspect Part 1

Network Inspect Part 2

This shows the containers connected to the Docker network.


🔌 Step 7: Health Check API

Endpoint:

GET /health

Test in browser:

http://localhost:3000/health

Health API

The response OK confirms the backend service is running.


➕ Step 8: Insert Student Record

curl -X POST http://localhost:3000/students \
-H "Content-Type: application/json" \
-d '{"name":"Vanshika","age":21}'

POST API

The student record is successfully inserted into PostgreSQL.


📥 Step 9: Fetch Student Records

curl http://localhost:3000/students

GET API

The inserted student record is retrieved successfully.


🌐 Step 10: Browser Testing

Students endpoint tested in browser:

http://localhost:3000/students

Browser Output


📡 Step 11: Verify Container IP Addresses

Backend container IP:

docker inspect backend_api | grep IPAddress

Backend IP

Database container IP:

docker inspect postgres_db | grep IPAddress

Database IP

This confirms both containers are connected to the Docker network.


💾 Step 12: Persistent Storage Proof

docker-compose down
docker-compose up

Docker Volumes

Docker Volumes

This confirms persistent storage for PostgreSQL data.


📦 Step 13: Docker Images

docker images

Docker Images

This shows the Docker images used in this project.


✔ Verification Summary

The following components were successfully verified:


👩‍💻 Author

Vanshika Munjal
SapId: 500121784
B.Tech – UPES