The developers handed over two containers: the application app and a practice database db. The database listens on port 5432 and answers every connection with the line db: ok. Every three seconds the application connects to it by the name db and writes the result to its log. Both containers are running, yet the application complains that the database is missing.
See for yourself. As in the previous lessons, docker commands here go through sudo. “Start” launches both containers.
Read the application log
Check that both containers are running, then read the app log.
First, predict
Both containers are Up. What does app write to its log?
Now start the exercise, run the command and compare your prediction with the output.
What does bad address 'db' in the app log mean?
-
A firewall gets in the way of connecting to an address, and there is no address here: nc found nowhere to connect to.
-
A refusal happens once there is an address and the connection has started.
bad addressmeans it never got that far: the name was not found. -
sudo docker psshows db asUp: the database is running.
bad address 'db' means nc found no address for the name db.