The Network Isolation Problem
LEVEL 0
The Problem
You’ve learned that each container has its own network namespace. This means each container thinks it has its own network stack:
- Its own network interfaces (like
eth0) - Its own IP address
- Its own ports (80, 443, 3000, etc.)
This isolation is powerful. Two containers can both run web servers on port 80 without conflicting.
But isolation creates problems:
Problem 1: How does the outside world reach a container?
A container’s IP address is in a private network (like 172.17.0.2). Your laptop can’t directly reach that IP. So how do you access a web server running in a container?
Problem 2: How do containers find each other?
If you have a web container and a database container, the web container needs to connect to the database. But the database’s IP address might change every time you restart it. How does the web container know where to connect?
Problem 3: How does a container reach the internet?
The container’s private IP address can’t be routed on the public internet. So how does a container make API calls to external services?
These are the networking challenges Docker solves.