How Containers Work
— a visual explainer
or use ← → arrow keys
💻
Your Laptop
Python 3.12 · NumPy 1.26 · libssl 3.0
✓ works
▼ deploy same code ▼
🖥️
Production Server
Python
3.9
· NumPy
1.21
· libssl
1.1
✗ crash
⚠ ImportError: incompatible library version
📦
Web App
Python 3.12
Flask 3.0
libssl 3.0
📦
ML Model
Python 3.11
PyTorch 2.2
CUDA 12
📦
Database
Postgres 16
pg_vector
config files
Web App
Python 3.12
Flask 3.0
ML Model
Python 3.11
PyTorch 2.2
Database
Postgres 16
pg_vector
isolated processes, shared kernel
Container Engine (Docker)
Host Operating System — Linux Kernel
Hardware — CPU · RAM · Disk
Your Laptop
💻
✓ runs
→
📦
same container
→
Test Server
🧪
✓ runs
→
Production
☁️
✓ runs
1. Your Flask app runs perfectly on your laptop but crashes on the production server with an ImportError. What is the most likely cause?
The server doesn't have enough RAM to run the application.
The server has different versions of Python or libraries than your local machine.
Flask doesn't support production deployments without a paid licence.
2. A container packages…
Only your application code, relying on the host for all dependencies.
Your code, its runtime, libraries, and config — everything it needs to run.
An entire operating system with its own kernel, like a virtual machine.
3. How do containers differ from virtual machines?
Containers include their own kernel; VMs share the host kernel.
Containers share the host kernel and start in milliseconds; VMs include a full OS and are heavier.
There is no meaningful difference — containers and VMs are the same technology.
4. You build and test a container on your laptop, then deploy it to a cloud server. What happens?
It needs to be rebuilt for the cloud server's operating system.
It will only work if the cloud server has the exact same OS version as your laptop.
It runs identically — the container carries its own environment inside.