Docker's Default Bridge Network

LEVEL 0

The Problem

You understand port mapping now. That solves the “external world → container” problem.

But what about container-to-container communication?

You run a web application in one container and a database in another container. The web container needs to connect to the database.

Without Docker networking, you’d have to:

  1. Find the database container’s IP address
  2. Hardcode it into the web container’s configuration
  3. Every time you restart the database, its IP might change, breaking the web container

There must be a better way.