Docker Course
Docker
/
Beginner

Docker Networking Basics

Definition

The subsystem that allows isolated Docker containers to communicate with each other, with the host machine, and with the outside internet, without compromising their security isolation.

Explain Like I'm New

Plugging ethernet cables into the boxes. Without networking, a container is completely deaf and blind. With networking, containers can talk to the database, and humans can talk to the web server.

Real World Example

You spin up a WordPress container and a MySQL container. Out of the box, they cannot see each other. You must attach both of them to a virtual 'Docker Network' so WordPress can send data to the database.

Common Use Cases

  • •Microservices communication
  • •External access

Interview Questions

basic

  • By default, if you start a container, can it access the public internet (e.g., to download a file)?

intermediate

  • By default, can two completely random containers talk to each other by their container names?

Flash Cards

Question

Can it access the internet?

Click to reveal answer
Answer

Yes. The default bridge network automatically sets up outbound internet access.

Question

Can they talk by name?

Click to reveal answer
Answer

No. On the default `bridge` network, they can only talk via IP address (which changes constantly). To communicate by human-readable names, you must create a Custom Bridge Network.