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.)
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.
Why this answer
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.
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.).