XK0-006 Automation, Orchestration, and Scripting Practice Question
A DevOps engineer is creating a Dockerfile for a Node.js application. Which THREE of the following instructions are valid and commonly used in a Dockerfile? (Choose THREE.)
⚠ Common exam trap
XK0-006 often tests recognition of valid Dockerfile instructions versus plausible-sounding but nonexistent ones (EXECUTE, INSTALL), so candidates must know the canonical instruction set (FROM, RUN, COPY, ADD, CMD, ENTRYPOINT, EXPOSE, WORKDIR, ENV, etc.).
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
✓
COPY . /app
Option B, COPY . /app, is correct because COPY is a valid Dockerfile instruction that copies files from the build context into the image filesystem, here placing the application source into /app. Option C, RUN npm install, is correct because RUN executes commands during the image build, and npm install is the standard way to install Node.js dependencies inside the image. Option E, FROM node:14, is correct because FROM is the required first instruction in a Dockerfile that sets the base image, and node:14 is a valid Node.js base image tag. Option A, EXECUTE node app.js, is not a Dockerfile instruction; the correct instruction for starting the container process is CMD or ENTRYPOINT. Option D, INSTALL package.json, is also not a Dockerfile instruction; dependency installation is done with RUN, and package.json is typically copied with COPY.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
EXECUTE node app.js
Why it's wrong here
EXECUTE is not a Dockerfile instruction; the runtime command belongs in RUN during build or CMD/ENTRYPOINT at container start. It tempts because running the Node process is genuinely needed, so a candidate recognises the intent, but Dockerfile syntax only accepts its fixed instruction set.
- ✓
COPY . /app
Why this is correct
COPY transfers files from the build context into the image, here placing the project's source at /app. It satisfies the need to get application code into the image before running npm install and CMD. Unlike ADD, COPY performs no URL fetching or archive extraction, keeping the build predictable.
- ✓
RUN npm install
Why this is correct
RUN executes commands during image build, installing Node.js dependencies into a layer before the container starts. This satisfies the stem's requirement for a valid, commonly used Dockerfile instruction, since npm install must run at build time so dependencies are baked into the image rather than installed at runtime.
- ✗
INSTALL package.json
Why it's wrong here
INSTALL is not a Dockerfile instruction; dependencies are installed with RUN npm install, which reads package.json rather than installing the file itself. It tempts because package.json must be present in the image, but that is achieved with COPY, and INSTALL exists in neither Dockerfile nor npm syntax.
- ✓
FROM node:14
Why this is correct
FROM node:14 sets the base image and tag, which every Dockerfile requires before any other build stage. It satisfies the stem's demand for a valid, commonly used instruction by pulling the official Node.js 14 image from Docker Hub, giving the build a defined runtime and filesystem layer to work from.
Go deeper
Related to this question
Learn chapter
Navigating the Filesystem
Key term
Process
In IT service management, a process is a structured set of activities designed to accomplish a specific objective, such as managing incidents or changes, by transforming inputs into defined outputs.
Key term
Dependency
A dependency is a piece of software, library, or package that another software application requires in order to function correctly.
About these practice questions
Courseiva writes every XK0-006 question from scratch — 781 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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official CompTIA exam blueprint
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.