DevOps-Containerization

NGINX Containerization and Reverse Proxy

A Comprehensive DevOps-Level Comparative Study using Ubuntu, Vagrant, Docker & Nginx


Overview

This experiment is designed to provide a deep, practical, and architectural understanding of two foundational technologies used in modern DevOps and cloud infrastructure:

Both technologies are implemented using Ubuntu Linux and a common application stack (Nginx Web Server) to ensure a fair, real-world comparison.


Why This Experiment Matters (DevOps Perspective)

In real-world DevOps pipelines:

Understanding when and why to use each is critical for:

This experiment bridges theory and hands-on execution.


Learning Objectives


System & Software Requirements

Hardware Requirements

Software Requirements


High-Level Architecture

Virtual Machine Stack

Physical Hardware
 └── Windows Host OS
     └── VirtualBox Hypervisor
         └── Ubuntu Guest OS
             └── Nginx Service

Container Stack

Physical Hardware
 └── Ubuntu OS (inside VM)
     └── Docker Engine
         └── Nginx Container

Conceptual Difference: VM vs Container

Aspect Virtual Machine Container
Kernel Own Kernel Shares Host Kernel
Startup Time Slow Very Fast
Resource Usage High Low
Isolation Strong Process-level
Portability Moderate Very High
Use Case OS-level isolation App-level deployment

Part A: Virtual Machine Implementation using Vagrant

Why Vagrant?

Vagrant allows Infrastructure as Code (IaC), enabling reproducible, automated, and consistent virtual machine environments without manual OS installation.


Step 1: Verify Vagrant Installation

vagrant --version

Step 2: Create Project Workspace

mkdir vm-lab
cd vm-lab

Step 3: Initialize Ubuntu VM Configuration

vagrant init ubuntu/jammy64

Step 4: Provision and Boot the VM

vagrant up

Step 5: Access the VM via SSH

vagrant ssh

Deploying Nginx inside the Virtual Machine

sudo apt update
sudo apt install -y nginx
sudo systemctl start nginx

Verify Nginx Deployment (VM)

curl localhost

Resource Monitoring (Virtual Machine)

free -h
htop
systemd-analyze

Part B: Containerization using Docker

Step 1: Install Docker Engine

sudo apt update
sudo apt install -y docker.io

Step 2: Start and Enable Docker

sudo systemctl start docker
sudo systemctl enable docker

Step 3: Configure Docker Permissions

sudo usermod -aG docker vagrant
exit
vagrant ssh

Verify Docker Installation

docker --version

Deploying Nginx as a Container

docker run -d -p 8080:80 --name nginx-container nginx

Verify Nginx Container

curl localhost:8080

Resource Monitoring (Container)

docker stats
free -h

Cleanup & Environment Management

docker stop nginx-container
docker rm nginx-container
exit
vagrant halt

Final Comparative Analysis

Parameter Virtual Machine Container
Boot Time High Very Low
Memory Usage High Low
CPU Overhead Higher Minimal
Disk Footprint Large Small
Isolation Level Strong Moderate
Scalability Moderate High

Result

The experiment confirms that:


Conclusion

Virtual Machines and Containers serve different but complementary purposes. While VMs remain essential for strong isolation and infrastructure boundaries, containers dominate application deployment due to speed, efficiency, and scalability.

This experiment successfully demonstrates both technologies in a real-world DevOps context.


Author Notes

This documentation follows industry-standard DevOps practices and mirrors real production workflows involving virtualization, containerization, and automated infrastructure management.