Default bridge network

Containers started without --network join the default bridge network. They can reach each other by IP address, but not by name.

How it works

The default bridge has no built-in DNS: from the api container, the name db does not resolve. IP addresses change each time a container is recreated, so writing one down breaks at the next restart. The old --link option is deprecated.

What breaks

"getaddrinfo ENOTFOUND db" or "could not translate host name" between two containers started with docker run almost always means they sit on the default bridge. Put them on a network you created.

In a terminal

docker network ls
docker network inspect bridge

See it break, then fix it

Write the Dockerfile or the compose file, type the docker commands, and watch a simulated server run them through reboots, upgrades and traffic. Free to start.