Virtualisation and Containers

The comparison that gets tested is what a container shares with the host and what a virtual machine does not. Everything else follows from that one difference.

Virtual machines against containers

PropertyVirtual machineContainer
IncludesA full guest operating systemApplication and its dependencies only
KernelIts ownShares the host kernel
SizeGigabytesMegabytes
Start timeTens of seconds to minutesUnder a second
IsolationStrong. Hardware-level boundaryWeaker. Process-level boundary
Density per hostTensHundreds
Runs a different OSYesNo. Linux containers need a Linux kernel
Best forLegacy applications, strong isolation, mixed operating systemsMicroservices, CI, horizontal scaling

Hypervisor types

TypeRuns onExamples
Type 1 (bare metal)Directly on the hardwareESXi, Hyper-V (role), Proxmox, KVM
Type 2 (hosted)On top of an operating systemVirtualBox, VMware Workstation, Parallels
PerformanceType 1 is faster, no host OS in the path
UseType 1 for servers, Type 2 for desktops and labs

Docker commands

CommandWhat it does
docker ps -aAll containers, including stopped ones
docker imagesLocal images
docker run -d -p 8080:80 nginxRun detached, publish host 8080 to container 80
docker exec -it NAME shShell inside a running container
docker logs -f NAMEFollow a container's logs
docker build -t name:tag .Build an image from a Dockerfile
docker rm / docker rmiRemove a container, remove an image
docker volume lsList volumes. Where persistent data lives
docker system pruneReclaim space from unused objects

Virtualisation terms

TermMeaning
SnapshotPoint-in-time state. Not a backup
Template / golden imageA base to clone new machines from
Thin provisioningAllocates storage as it is used
OvercommitAssigning more virtual resource than physically exists
VM sprawlMachines created and never decommissioned
VM escapeBreaking out of a guest into the hypervisor
Live migrationMoving a running machine between hosts
Resource poolShared CPU and memory allocated to a group

Now test yourself

Memorizing a table is a start. Practice questions are what make it stick, and every answer carries the full explanation.