Why Containers?
Understand the problem containers solve and why Docker became the industry standard.
Before containers, deploying software was painful:
- Dev runs Python 3.11, production server has Python 3.9 → app crashes
- Dev has library version 2.0, server has 1.8 → subtle bugs
- Setting up a new server meant hours of manual configuration
- Teams wasted days debugging environment differences
A container packages your app and everything it needs into a single unit:
- Your code
- The exact Python version
- Every dependency at the exact version
- System libraries and config
That unit runs identically on your laptop, your colleague's machine, CI/CD, and production. No more environment differences.
Both isolate software, but they work differently:
Virtual Machine: Container:
┌─────────────┐ ┌─────────────┐
│ Your App │ │ Your App │
│ Libraries │ │ Libraries │
│ Guest OS │ ├─────────────┤
│ Hypervisor │ │ Container │
│ Host OS │ │ Runtime │
│ Hardware │ │ Host OS │
└─────────────┘ │ Hardware │
└─────────────┘VMs virtualise the entire operating system — heavy, slow to start (minutes), large (GBs).
Containers share the host OS kernel — lightweight, start in seconds, small (MBs). That's why Docker is preferred for deploying apps.
What does a Docker container include?
- AYour app, its dependencies, and the runtime — everything needed to run identically anywhere
- BOnly your application code
- CA full virtual operating system
- DOnly the system libraries
Why are containers faster to start than virtual machines?
- AContainers share the host OS kernel instead of running a full guest OS
- BContainers use less code
- CContainers run on faster hardware
- DContainers skip the boot sequence
A container packages your app and all its ___ into a single portable unit.