200-901 Application Deployment and Security Practice Question
You are writing a Dockerfile. Which instruction should you use to set the working directory for subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions?
⚠ Common exam trap
Cisco often tests the distinction between RUN cd (which is ephemeral) and WORKDIR (which is persistent), leading candidates to mistakenly think a shell cd command can set the working directory for all subsequent instructions.
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
✓
WORKDIR /app
The WORKDIR instruction in a Dockerfile sets the working directory for any subsequent RUN, CMD, ENTRYPOINT, COPY, and ADD instructions. This ensures that commands execute from that directory and that COPY/ADD paths are resolved relative to it. Option A is correct because WORKDIR is the only Dockerfile instruction designed specifically for this purpose.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
WORKDIR /app
Why this is correct
WORKDIR sets the working directory for all subsequent Dockerfile instructions.
- ✗
RUN cd /app
Why it's wrong here
RUN cd only affects that specific layer; it does not persist for subsequent instructions.
- ✗
ENV WORKDIR=/app
Why it's wrong here
ENV sets environment variables, not the working directory.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every 200-901 question from scratch — 989 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 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.