📦Container Network
Also known as Docker Network, Bridge Network (Docker), User-Defined Network, docker network create
A private network that lets boxes talk to each other by name.
Think of it like
Think of it like a private hallway. The rooms on it can knock on each other's doors by name.
Example
Why it matters
Apps split across containers need to find each other. Names on a shared network do that without fixed addresses.
Definition
Example code
bash
docker network create shop
docker run -d --network shop --name db -e POSTGRES_PASSWORD=pw postgres:17
docker run -d --network shop --name web -p 8080:80 shop-webCommon mistake
Key takeaways
- 1Private. Only containers that join can talk.
- 2Names work. On a network you create yourself.
- 3Default is plain. The built-in bridge has no names.