- Beginner
- Networking
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.