Cloud Computing

Lesson 3 of 6

Lesson 3 — Virtual Machines and Containers

How one physical server pretends to be fifty, and why containers made deployment boring (in a good way).

🟡 Intermediate 85 XP

Learn it

A virtual machine is a fake computer running inside a real one, with its own operating system.

A container packages just your app and its dependencies, sharing the host's operating system — so it starts in milliseconds.

Orchestrators like Kubernetes run thousands of containers, restarting and rescheduling them automatically.

Key terms

Hypervisor
Software that creates and runs virtual machines on physical hardware.
Container
An isolated process bundle sharing the host kernel, built from an image.
Image
A read-only template containing the app, libraries and config to run it.
Orchestration
Automated scheduling, healing and scaling of many containers.
Immutable infrastructure
Servers are replaced, never edited in place.

Boot race: VM vs container

Deploy the same web app two ways and watch the clock.

  1. 1VM path: Provision instance → boot 2 GB OS image (~40 s) → install runtime → copy app → start service.
  2. 2Container path: Pull 90 MB image → start process (~0.3 s) → healthy.
  3. 3Scale to 20: VMs: minutes and 40 GB of duplicated OS. Containers: seconds and one shared kernel.
  4. 4Trade-off: A kernel bug escapes a container more easily than a VM — that's why multi-tenant providers still run containers inside VMs.

A Dockerfile

dockerfileFROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
ENV PORT=8080
EXPOSE 8080
CMD ["node", "server.js"]

Each line is a cached layer. Copying package files before the source means dependency layers are reused when only your code changes — builds go from minutes to seconds.

Sandbox lab

Practise the real technique in a fully simulated environment — no live systems, no real data, nothing leaves your browser.

Cloud cost simulator

Architect the stack, then get graded on cost, performance, reliability and waste.

Simulated billing

A mostly-static school website. Traffic is small and steady, images are read constantly, budget is tight.

1.5M requests/month120 GB stored (80% hot)Budget £60/mop95 < 350msUptime ≥ 99.5%One region of users

Storage class

Compute

Baseline instances2

Scaling strategy

Database

Try it

Complete the scaling command so Kubernetes runs five copies of the app.

kubectl scale deployment web ______=5

Challenge

Your app works locally but crashes in production with 'module not found'. Explain how containers would have prevented this, and describe one thing containers do NOT fix.

Pick whichever way suits you — every mode earns the same bonus XP.

Write at least 40 more characters to submit.

Mark your own work

Guided walkthrough — 0/4 clues revealed

  1. Clue 1 locked — reveal it only if you get stuck.
  2. Clue 2 locked — reveal it only if you get stuck.
  3. Clue 3 locked — reveal it only if you get stuck.
  4. Clue 4 locked — reveal it only if you get stuck.

Each clue costs 5 XP (never below 22 XP). You'd earn 43 XP right now.

Quiz time

Question 1 of 4Score 0

What isolates a container's view of the filesystem and processes?