- On Docker's default network (
bridge) containers see each other by address and ask the host's DNS servers for names — and those servers do not know container names. - In a network of your own (
docker network create) Docker's DNS at127.0.0.11answers with the names of that network's containers. - A container joins a network when it is created (
--network) or on the fly (docker network connect). - A neighbour connects by name and by the port of the program inside the container; a published port is the entrance from the host.
- app wrote
bad address 'db'because both containers were on the default network: there was nobody to ask about the namedb.
Step 6 of 6 · summary · 2 min
Summary
Found an inaccuracy? Report an error in the lesson