Virtualization & Containers
Virtualization lets you run multiple OS on one machine. Containers (Docker) are lighter and more portable than VMs.
25 min•By Priygop Team•Last updated: Feb 2026
Virtualization & Containers
Virtualization creates Virtual Machines (VMs) — each VM has its own OS, running on shared physical hardware. A hypervisor (like VMware or KVM) manages this. Docker containers are lighter: they share the host OS kernel but isolate the application. Containers start in seconds (VMs take minutes), use less memory, and are highly portable — 'it works on my machine' is no longer a problem.
VMs vs Containers
- VM — Full OS per instance. 1-5 GB each. Boots in minutes. Strong isolation. Good for different OS needs
- Container — Shares host OS kernel. 10-100 MB each. Starts in seconds. Process isolation. Perfect for microservices
- Docker — Most popular container platform. Write a Dockerfile, build an image, run anywhere
- Kubernetes (K8s) — Orchestrates containers at scale. Auto-scaling, load balancing, self-healing
- Docker Hub — Public registry with 100,000+ pre-built container images
- Microservices — Architecture where each service runs in its own container
Docker Basics
Example
# Dockerfile — Instructions to build a container image
FROM node:18-alpine # Start from Node.js base image
WORKDIR /app # Set working directory
COPY package*.json ./ # Copy package files
RUN npm install # Install dependencies
COPY . . # Copy app source code
EXPOSE 3000 # Expose port 3000
CMD ["node", "server.js"] # Start the app
# Build and run commands:
# docker build -t my-app . # Build image
# docker run -p 3000:3000 my-app # Run container
# Docker Compose — Run multiple containers together
# docker-compose.yml:
# version: '3'
# services:
# web:
# build: .
# ports: ["3000:3000"]
# db:
# image: postgres:15
# environment:
# POSTGRES_PASSWORD: secret
# Benefits of containers:
# ✓ "Works on my machine" → Works everywhere
# ✓ Consistent environments (dev = staging = production)
# ✓ Fast startup (seconds vs minutes for VMs)
# ✓ efficient resource usage