Container-to-Container DNS
Two containers, api and db, should talk to each other. Which setup lets api reach the database at hostname db?
api
db
Choose one answer
Add --link to the api container; it is the recommended modern approach.
--link
Create a user-defined network and attach both containers to it.
Run both on the default bridge network; container names resolve automatically there.
bridge
Publish the database port with -p 5432:5432 and connect to db:5432.
-p 5432:5432
db:5432