EX200 Manage containers Practice Question
A containerized application writes logs to stdout. The administrator wants to view only the last 50 lines of logs from a container named 'app1'. Which command accomplishes this?
⚠ Common exam trap
Candidates often confuse `--tail` with `--lines` or `-n`, which are common in other tools like `tail` or `kubectl logs`, but Podman specifically uses `--tail` for this purpose.
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
✓
podman logs --tail 50 app1
The `podman logs --tail 50 app1` command is correct because `--tail` is the Podman option to specify the number of lines from the end of the log to display. This directly fulfills the requirement to view only the last 50 lines of logs from the container named 'app1'.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
podman logs --lines 50 app1
Why it's wrong here
The `--lines` flag is not recognized by `podman logs`. The `podman logs` command uses `--tail` to specify the number of lines to display from the end of the container's log output. Attempting to pass `--lines` will cause podman to return an invalid option error, so the command will not produce any log output at all. To display the last 50 lines, the correct flag is `--tail 50`.
- ✗
podman logs app1
Why it's wrong here
Running `podman logs app1` without any options outputs the entire log content of the container, which could be very large for a long-running application. This does not satisfy the requirement to show only the last 50 lines. While this command is valid, it fails to limit the output, making it unusable for quickly checking the most recent log entries. Use `--tail` to restrict the output to the desired number of lines.
- ✗
podman logs -n 50 app1
Why it's wrong here
The short flag `-n` is not defined for `podman logs`. Podman logs does not support an `-n` alias for line count; the only way to specify a line count is by using the long option `--tail`. Therefore, `podman logs -n 50 app1` will result in an unrecognized flag error. This is a common mistake because some other commands like `systemctl` or `journalctl` use `-n` to limit lines, but podman uses `--tail`.
- ✓
podman logs --tail 50 app1
Why this is correct
The `--tail` option explicitly instructs `podman logs` to output only the last 50 lines of the container's log stream. This is the exact functionality needed to satisfy the admin's requirement. The syntax `podman logs --tail 50 app1` is correct and will work as expected. Specifying a numeric value after `--tail` is the standard way to limit log output to the most recent entries.
Go deeper
Related to this question
About these practice questions
One of 427 original EX200 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 EX200 practice question is part of Courseiva's free Red Hat 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 EX200 exam.