DCA Data Analysis & Reporting 4 — Questions and Answers
Question 1: Which open-source tool is commonly used to collect per-container resource metrics and expose them to Prometheus in a Docker environment?
- Logstash
- cAdvisor (Correct answer)
- Telegraf
- Fluentd
Correct answer: cAdvisor
cAdvisor (Container Advisor) collects per-container CPU, memory, and network metrics and exposes a Prometheus endpoint.
Question 2: You run `docker logs --since 2h api`. What does this output?
- Logs from the last 2 hours of uptime
- Logs generated in the past 2 hours of wall-clock time (Correct answer)
- The first 2 hours of container logs only
- Logs timestamped exactly 2 hours ago
Correct answer: Logs generated in the past 2 hours of wall-clock time
`--since 2h` filters logs to those produced within the last 2 hours of real (wall-clock) time.
Question 3: Which `docker events` filter would show only container die events?
- --filter status=die
- --filter event=die
- --filter type=container --filter event=die (Correct answer)
- --filter action=die
Correct answer: --filter type=container --filter event=die
Combining `--filter type=container` and `--filter event=die` precisely targets container die events.
Question 4: What does the `PIDS` column in `docker stats` output represent?
- Total number of Docker processes on the host
- Number of processes or threads running inside the container (Correct answer)
- Process ID of the container's init process
- Number of paused containers
Correct answer: Number of processes or threads running inside the container
The `PIDS` column shows how many processes or threads are currently running inside that container.
Question 5: When configuring the `awslogs` log driver, which option specifies the CloudWatch log group name?
- awslogs-region
- awslogs-group (Correct answer)
- awslogs-stream
- awslogs-bucket
Correct answer: awslogs-group
The `awslogs-group` option sets the CloudWatch Logs group where container logs are sent.
Question 6: You need to extract the container's IP address from `docker inspect` output using a Go template. Which template expression is correct?
- {{.Network.IPAddress}}
- {{.NetworkSettings.IPAddress}} (Correct answer)
- {{.Config.IPAddress}}
- {{.HostConfig.IPAddress}}
Correct answer: {{.NetworkSettings.IPAddress}}
The IP address lives at `{{.NetworkSettings.IPAddress}}` in the inspect JSON structure.
Question 7: Which `docker system df` flag shows a detailed breakdown per image, container, and volume?
- --all
- --verbose
- --details
- -v (Correct answer)
Correct answer: -v
`docker system df -v` adds a verbose per-item breakdown instead of aggregated totals.
Which open-source tool is commonly used to collect per-container resource metrics and expose them to Prometheus in a Docker environment?