Courseiva
hardMultiple ChoiceObjective-mapped

XK0-006 Practice Question: A containerized application writes logs to…

A containerized application writes logs to /var/log/app.log. The administrator wants to ensure logs persist even if the container is removed. Which approach should be used?

⚠ Common exam trap

It's easy for candidates to confuse bind mounts with Docker volumes, thinking that any host-path mapping provides automatic persistence, or they may assume that docker logs retains logs after container removal, when in fact it only works for running or stopped containers, not removed ones.

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

Use a Docker volume mounted at /var/log

Docker volumes are managed by Docker and persist independently of the container lifecycle. By mounting a volume at /var/log, the application writes logs directly to the volume, ensuring the data survives container removal and can be reused by other containers.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Copy logs to a bind mount

    Why it's wrong here

    A bind mount maps a host directory into the container; if not mounted, logs are lost. This is not automatic.

  • Set the log driver to syslog

    Why it's wrong here

    Changes the logging driver to send logs to syslog, but still container-local unless syslog is external.

  • Redirect logs to stdout and use docker logs

    Why it's wrong here

    This captures logs only while the container exists; logs are lost when the container is removed.

  • Use a Docker volume mounted at /var/log

    Why this is correct

    A Docker volume is managed by Docker and persists across container removal, retaining logs.

About these practice questions

One of 979 original XK0-006 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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This XK0-006 practice question is part of Courseiva's free CompTIA 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 XK0-006 exam.