200-901 Application Deployment and Security Practice Question
A developer needs to view the logs of a running Docker container with ID 'abc123'. Which command should be used?
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 abc123
docker logs -f follows the log output. docker exec runs a command inside container, docker attach attaches to a running container's I/O, docker inspect shows detailed info.
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 inspect abc123
Why it's wrong here
docker inspect returns container configuration and state metadata as JSON; it does not display stdout or stderr output. It is tempting because it targets a specific container and reveals runtime details, but log retrieval is performed by docker logs abc123, which streams the container's captured output.
- ✗
docker exec -it abc123 logs
Why it's wrong here
This runs a new process named 'logs' inside the container, which does not exist, so it fails; log retrieval is a Docker CLI operation against the daemon, not an in-container command. It is tempting because exec -it is the standard pattern for running commands inside containers, and it would be correct for opening an interactive shell.
- ✓
docker logs -f abc123
Why this is correct
docker logs retrieves stdout and stderr from the specified container, and -f follows the stream so output continues as the container writes. Passing the container ID abc123 targets that exact container, satisfying the requirement to view its logs.
- ✗
docker attach abc123
Why it's wrong here
Attaching connects your terminal's standard input and output to the container's main process, streaming live stdout rather than reading the log history Docker already captured. It is tempting because it does surface running output, and it would suit interactive debugging of a foreground process, but it cannot retrieve past log entries.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.