200-901 Application Deployment and Security Practice Question
A developer has a Docker container running a database. They need to inspect the database logs to debug a connection issue. Which command will show the logs in real-time?
⚠ Common exam trap
Cisco often tests the distinction between `docker exec` (for running commands inside a container) and `docker logs` (for retrieving container output streams), and the trap here is that candidates may mistakenly think they need to exec into the container and use a Linux command like `tail -f` instead of using the native Docker log-following feature.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
docker logs -f my-db
The `docker logs -f` command attaches to the container's stdout/stderr streams and follows new output in real-time, which is exactly what is needed to debug a live connection issue. The `-f` flag (short for `--follow`) continuously prints log lines as they are written, allowing the developer to observe database connection attempts and errors as they occur.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
docker exec my-db tail -f /var/log/mysql
Why it's wrong here
This streams a file from inside the container, which works only if that path exists and the image includes tail; it also bypasses Docker's own log driver. docker logs --follow my-db reads the container's stdout/stderr stream in real time, which is the intended mechanism.
- ✗
docker logs --tail 100 my-db
Why it's wrong here
The --tail 100 flag prints the last 100 lines and exits; it does not stream. Real-time output requires the --follow flag, which keeps the connection open and prints new entries as written. --tail is tempting for limiting noisy historical output, and would suit reviewing recent entries after a crash.
- ✗
docker logs my-db
Why it's wrong here
Plain docker logs dumps existing output and returns to the prompt; it never streams new entries. Real-time viewing needs --follow, which holds the stream open. This command is tempting for a quick one-off check of what a container has already logged, and would be right for reviewing a stopped container's history.
- ✓
docker logs -f my-db
Why this is correct
docker logs -f streams the container's stdout and stderr continuously, following new output as it is written, which is what real-time debugging of the database connection issue requires. The -f flag distinguishes it from a one-off dump of existing log entries.
Go deeper
Related to this question
About these practice questions
One of 975 original 200-901 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.