Skip to content
StackDecode
IntermediateLesson 9 of 26

Container networking

How containers find and talk to each other.

The default bridge network works, but containers can only reach each other by IP. On a user-defined bridge Docker also gives you DNS: a container is reachable by its name.

bash
docker network create appnet
docker run -d --name db --network appnet postgres:16
docker run --rm --network appnet alpine ping -c1 db    # resolves "db"
docker network inspect appnet

Other drivers: host (share the host's network, Linux only), none (no networking), overlay (multi-host, Swarm).