Docker Fundamentals

Lesson 1 of 6

Why Docker? Containers vs. Virtual Machines

"It works on my machine" is one of the oldest problems in software. Docker solves it by packaging an application together with everything it needs to run, code, runtime, libraries, system tools, into a single container that behaves the same everywhere.

Containers vs. virtual machines

Virtual MachineContainer
IncludesA full guest operating systemJust the app and its dependencies
Startup timeMinutesSeconds
SizeGigabytesOften megabytes
IsolationFull hardware-level virtualizationShares the host OS kernel, isolated processes

Containers are lighter because they don't boot a whole separate operating system, they share the host machine's kernel but keep everything else (filesystem, processes, network) isolated.

Images vs. containers

  • An image is a read-only template, the blueprint (think: a class).
  • A container is a running instance of an image (think: an object). You can start many containers from the same image.

NOTE

Docker Desktop (or Docker Engine on Linux) is the tool that builds images and runs containers. Install it before the next lesson.

📝 Containers Quiz

Passing score: 70%
  1. 1.What do containers share with the host machine that virtual machines do not?

  2. 2.A Docker ____ is the read-only template that containers are started from.

  3. 3.You can run multiple containers from the same image at the same time.