KCSA practice question 3 of 15
What is a multi-stage build?
Full set: 59 questionsA multi-stage build is a feature used in Dockerfiles to create more efficient and smaller container images. It involves using multiple FROM instructions, where each FROM starts a new, temporary build stage. An initial stage might use a larger image containing compilers, SDKs, and build tools to compile the application. A subsequent, final stage then starts from a minimal base image (e.g., alpine or distroless) and copies only the necessary compiled artifacts from the initial stage. This process discards all intermediate build tools and dependencies, resulting in a significantly smaller, optimized, and more secure production image.
A. This describes a collaborative development workflow, not the technical process of a multi-stage build.
B. This refers to the architecture of a container registry or image distribution strategy, not the image creation process.
C. This describes parallelization, whereas multi-stage builds are about sequential stages to isolate build-time and run-time environments.
1. Docker Official Documentation, "Multi-stage builds": "With multi-stage builds, you use multiple FROM statements in your Dockerfile. Each FROM instruction can use a different base, and each of them begins a new stage of the build. You can selectively copy artifacts from one stage to another, leaving behind everything you don’t want in the final image."
2. Red Hat OpenShift Documentation, "Creating images using a multi-stage build": "A multi-stage build is a process that divides the Dockerfile into multiple stages to separate the build-time dependencies from the run-time dependencies... The final image is smaller and more secure because it does not contain the build-time dependencies." (Section: "About multi-stage builds").
3. Google Cloud Documentation, "Container build best practices": "One of the most effective ways to minimize your image size is to use Docker's multi-stage builds. For example, you can use a build stage that contains the build tools for your application, and a separate runtime stage that contains only the application runtime and the built application." (Section: "Minimize image size").
Keep practicing
Take the free KCSA practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other KCSA practice questions
- Question 1Which information does a user need to verify a signed container image?
- Question 2A container running in a Kubernetes cluster has permission to modify host processes on th…
- Question 4What is the difference between gVisor and Firecracker?
- Question 5Which of the following statements on static Pods is true?
- Question 6A cluster is failing to pull more recent versions of images from k8s.gcr.io. Why may this…
- Question 7What mechanism can I use to block unsigned images from running in my cluster?
