Using Names Instead of IPs
On a user-defined Docker network, Docker's embedded DNS resolves container names and Compose service names. Applications should therefore connect to a database using a stable service name such as db.
This makes container replacement easier because the application does not need to learn the new container IP.
ADVERTISEMENT