The shop's API connects to the database by the name db. When both containers run on the default bridge network, that name leads nowhere, and the API cannot find the database. Customers need only the API, and the database must not be reachable from the host.