XK0-006 Automation, Orchestration, and Scripting Practice Question
An administrator needs to deploy a set of microservices using Docker Compose. The services require configuration values that vary between development and production environments. Which approach allows the administrator to override values without modifying the docker-compose.yml file?
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 multiple compose files with the -f flag: docker-compose -f docker-compose.yml -f docker-compose.prod.yml up.
Docker Compose supports multiple compose files; using multiple -f options allows overriding values from the base file. Environment-specific files like docker-compose.override.yml are automatically used if present, but using explicit -f options is more flexible for different environments.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Define multiple services in one docker-compose.yml and use profiles.
Why it's wrong here
Profiles are for enabling/disabling services, not for overriding configuration values.
- ✗
Use environment variables in the Dockerfile and pass them via docker run -e.
Why it's wrong here
Docker Compose uses the docker-compose.yml file, not individual docker run commands.
- ✗
Use the extends keyword in docker-compose.yml.
Why it's wrong here
extends is used to share configuration between services, not for environment-specific overrides.
- ✓
Use multiple compose files with the -f flag: docker-compose -f docker-compose.yml -f docker-compose.prod.yml up.
Why this is correct
Correct. Multiple -f files allow overriding settings from the base file.
Go deeper
Related to this question
About these practice questions
Courseiva writes every XK0-006 question from scratch — 979 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 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.