200-901 Application Deployment and Security Practice Question
A docker-compose.yml defines a web service with environment variables. Which key in the service definition should be used to set environment variables?
⚠ Common exam trap
Cisco often tests the distinction between build-time (`args`) and runtime (`environment`) configuration, so the trap here is confusing `args` (used in `docker build`) with `environment` (used in `docker run` or `docker-compose up`), especially since both can pass key-value pairs but serve entirely different lifecycle stages.
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
✓
environment
The `environment` key in a Docker Compose service definition is the standard way to set environment variables directly within the YAML file. This key accepts a list of key-value pairs (e.g., `- KEY=VALUE`) or a mapping, and the variables are injected into the container at runtime, overriding any default values in the Docker image.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
args
Why it's wrong here
args is for build-time arguments, not runtime environment variables.
- ✗
volumes
Why it's wrong here
volumes mount directories, not set environment variables.
- ✓
environment
Why this is correct
The 'environment' key allows setting environment variables directly.
- ✗
env_file
Why it's wrong here
env_file points to a file, not inline environment variables.
Go deeper
Related to this question
About these practice questions
This 200-901 question is part of Courseiva's 989-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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 200-901 practice question is part of Courseiva's free Cisco 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 200-901 exam.