# Container Network

> A private network that lets boxes talk to each other by name.

**Field:** Infrastructure  
**Category:** Containers  
**Also known as:** Docker Network, Bridge Network (Docker), User-Defined Network, docker network create

## Think of it like

Think of it like a private hallway. The rooms on it can knock on each other's doors by name.

## Definition

A container network is a private network that containers join so they can talk. Each one gets its own address on it. On a network you make yourself, they can reach each other by name, such as db or web. The built-in default network, called bridge, does not look up names. Boxes on different networks cannot reach each other unless you join them.

## Example

Lucy creates a network called shop and starts a web container and a db container on it. The web app connects to the database at the address db.

## 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-web
```

Both boxes join the shop network. So the web app can reach the database by the name db.

## Why it matters

Apps split across containers need to find each other. Names on a shared network do that without fixed addresses.

## Common mistake

Expecting names to work on the default network. Only a network you create looks up container names.

## Three principles

- **Private.** Only containers that join can talk.
- **Names work.** On a network you create yourself.
- **Default is plain.** The built-in bridge has no names.

## Related terms

- [Container](https://learn.benibix.com/term/infrastructure/container)
- [Docker](https://learn.benibix.com/term/infrastructure/docker)
- [Container Port Mapping](https://learn.benibix.com/term/infrastructure/container-port-mapping)
- [Docker Compose](https://learn.benibix.com/term/infrastructure/docker-compose)
- [Domain Name System (DNS)](https://learn.benibix.com/term/infrastructure/dns)
- [Internet Protocol Address (IP Address)](https://learn.benibix.com/term/infrastructure/ip-address)

![A host box holding two containers, web and db, on a shared network line labelled shop. Host port 8080 has an arrow to port 80 in the web container. A host folder called project has a line into the web container's /app folder.](https://learn.benibix.com/diagrams/inf4-container-wiring.svg)

---

Source: https://learn.benibix.com/term/infrastructure/container-network
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
