mediumMultiple ChoiceObjective-mapped
XK0-006 Practice Question: Deploying a new web application using Docker…
A company is deploying a new web application using Docker containers. The application requires configuration values that vary between environments (development, staging, production). Which approach ensures the configuration is securely managed and applied without modifying the container image?
⚠ Common exam trap
CompTIA often tests the misconception that environment variables alone are sufficient for all configuration, including secrets, but the trap here is that Docker secrets provide an additional security layer for sensitive data, while environment variables are appropriate for non-sensitive configuration values.
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
✓
Pass configuration via environment variables and use Docker secrets for sensitive data.
Docker supports passing configuration via environment variables at runtime without altering the image, and Docker secrets securely manage sensitive data (e.g., passwords, API keys) by storing them in encrypted memory and mounting them as temporary files in `/run/secrets/`. This decouples configuration from the immutable image, adhering to the twelve-factor app methodology and ensuring environment-specific values are applied without rebuilding.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Pass configuration via environment variables and use Docker secrets for sensitive data.
Why this is correct
Environment variables allow runtime configuration without modifying the image, and secrets provide secure handling of sensitive data.
- ✗
Build separate images for each environment with the configuration baked in.
Why it's wrong here
Building separate images for each environment defeats the purpose of immutable infrastructure and increases maintenance overhead.
- ✗
Store configuration in a JSON file within the base image and override it at runtime.
Why it's wrong here
Storing config in the base image requires modifying the image for changes, and overriding at runtime is less secure than environment variables.
- ✗
Use a Dockerfile to copy the configuration file from the host at build time.
Why it's wrong here
Copying config files at build time embeds environment-specific values, reducing portability.
Go deeper
Related to this question
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 →
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.