KEMBAR78
Week 6 Lecture | PDF | Virtual Machine | Cloud Computing
0% found this document useful (0 votes)
6 views7 pages

Week 6 Lecture

The document discusses the differences between containers and virtual machines, highlighting their architectures, pros, and cons. It introduces Docker as a popular container platform and Kubernetes for managing containerized applications. Practical tasks for students are included to compare VMs and Docker, as well as hands-on activities with Docker and Kubernetes.

Uploaded by

jannatimtiaz288
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views7 pages

Week 6 Lecture

The document discusses the differences between containers and virtual machines, highlighting their architectures, pros, and cons. It introduces Docker as a popular container platform and Kubernetes for managing containerized applications. Practical tasks for students are included to compare VMs and Docker, as well as hands-on activities with Docker and Kubernetes.

Uploaded by

jannatimtiaz288
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Containers vs.

Virtual Machines (Docker &


Kubernetes)
1. Recap of previous lecture:
• What are the different cloud computing models (IaaS, PaaS, SaaS)?
• How do public, private, and hybrid clouds differ?
• Steps to deploy a virtual machine on AWS/Azure/Google Cloud.

Discussion:

• What challenges did you face while setting up cloud-based virtual machines?
• When should you use cloud VMs vs. on-premises VMs?

2. Introduction to Containers vs. Virtual Machines:


Definition:

A Virtual Machine (VM) is a software-emulated computer that runs a full OS and applications,
isolated from the host system.

Architecture of a VM:

[Hardware]

[Host OS]

[Hypervisor]

[Guest OS (Linux/Windows)]

[Apps]

Pros:

• Strong isolation
• Run different OSes on the same machine
• Mature technology (used widely in cloud platforms)
Cons:

• Heavyweight: Each VM includes an entire OS


• Slower boot time
• High resource usage (RAM, CPU, storage)

Part 2: What Are Containers (Docker)?

Definition:

A container is a lightweight, standalone package that contains everything needed to run a piece
of software — code, runtime, libraries, and settings — but shares the host OS kernel.

Docker = Most popular container platform

Docker Container Architecture:

[Hardware]

[Host OS]

[Docker Engine]

[Containers (App + Dependencies)]

Pros:

• Lightweight and fast (no separate OS)


• Faster startup and scaling
• Ideal for microservices
• Easy to version, ship, and deploy

Cons:

• Weaker isolation than VMs


• Not suited for running different OS types (e.g., Windows + Linux)
Comparison Table: VMs vs. Containers

Feature Virtual Machines Containers (Docker)


OS Full guest OS Share host OS kernel
Size Hundreds of MBs to GBs Tens of MBs
Boot Time Minutes Seconds
Performance More overhead Near-native
Isolation Strong (separate kernel) Moderate (shared kernel)
Portability Limited to VM format Highly portable
Use Case Monolithic apps, multi-OS testing Microservices, cloud-native development

Part 3: What is Kubernetes?

Definition:

Kubernetes is an open-source platform to automate deployment, scaling, and management of


containerized applications.

Why use Kubernetes?

• Manages 100s or 1000s of containers


• Ensures high availability
• Automatically restarts or replaces failed containers
• Load balancing and service discovery

Key Concepts:

Concept Description

Pod Smallest unit, contains one or more containers

Node A machine (VM or physical) that runs Pods

Cluster A group of nodes managed by Kubernetes

Deployment Manages replica sets and rolling updates

Service Defines how to access Pods (internal/external)


Kubernetes Architecture:

[Master Node]
└─ API Server
└─ Scheduler
└─ Controller Manager
└─ etcd (storage)

[Worker Nodes]
└─ Kubelet
└─ Container Runtime (Docker, containerd)
└─ Pods (containers)

Practical Tasks for Students

Task 1: Compare VM vs Docker

• Create a VM using VirtualBox


• Create a Docker container with ubuntu
• Compare performance, boot time, and memory usage

Task 2: Docker Basics

• Install Docker
• Run hello-world
• Create and run a custom container for Python or Node.js

Task 3: Docker Compose

• Use Docker Compose to run a web app + database (e.g., Flask + MySQL)

Task 4: Kubernetes with Minikube

• Install Minikube
• Deploy a simple Nginx pod
• Scale the pod and expose a service

Conclusion

• VMs = Great for full OS isolation and legacy apps


• Containers = Lightweight, portable, modern deployment
• Kubernetes = Automates and scales container management
What are Containers?

• Lightweight virtualization at the OS level (shares the host kernel).\


• Uses container runtimes (e.g., Docker, Podman).
• Faster startup and lower resource usage than VMs.

Key Differences Between Containers & VMs

Feature Virtual Machines Containers


Size Large (GBs) Small (MBs)
Startup Time Minutes Seconds
Isolation Strong (separate OS) Process-level
Resource Usage High (dedicated resources) Low (shared kernel)
Use Case Full OS simulation Microservices, cloud apps

3. Understanding Docker:
What is Docker?

Docker is a containerization platform that enables developers to package applications and


dependencies into lightweight, portable containers.

Docker Components

Docker Engine – Runs containers.


Docker Images – Pre-packaged environments for applications.
Docker Containers – Instances of Docker images.
Docker Hub – Repository for storing and sharing images.

How Containers Improve Virtualization?

Faster deployment (containers start instantly).


Portability (runs the same on any system).
Efficient resource utilization (low overhead).
4. Hands-on Docker Lab:
Lab Activity: Running Your First Docker Container

Install Docker on your machine.


Run a basic container:

docker run hello-world

Pull and run an Nginx web server container:

docker run -d -p 8080:80 nginx

List running containers:

docker ps

Stop and remove a container:

docker stop <container_id>


docker rm <container_id>

6. Lab Activity: Running Containers on Kubernetes:


Install Minikube (local Kubernetes cluster).
Deploy an NGINX pod in Kubernetes:

kubectl create deployment nginx --image=nginx

Expose the NGINX service:

kubectl expose deployment nginx --type=NodePort --port=80

Get the running pod details:

kubectl get pods

Access the web server using Minikube’s IP.


7. Recap & Discussion:
What did we learn today?

• Differences between Containers & VMs.


• Docker Basics: Running & Managing Containers.
• Introduction to Kubernetes & Container Orchestration.

Next Session Preview:

• Advanced Docker: Building Custom Images & Docker Compose.


• Managing Multi-Container Applications.

8. Homework / Preparation for Next Class


Research real-world use cases of Docker & Kubernetes.
Try building a custom Docker image using a Dockerfile.
Read about Docker Compose & container networking.

You might also like