CompTIA Linux+ XK0-006 (V8) Practice Question

Consider the following excerpt from a Dockerfile used to containerize a Go microservice:

FROM golang:1.22-alpine AS builder
WORKDIR /src
COPY . .
RUN go build -o /app/service

FROM scratch
COPY --from=builder /app/service /service
ENTRYPOINT ["/service"]

What specific effect does the second FROM scratch instruction have on the image-build process?

  • It merges the filesystem layers from the builder stage with those of scratch, producing an image that contains both the Go toolchain and the compiled binary.

  • It instructs Docker to pull the scratch image from Docker Hub; if the image cannot be pulled the build fails.

  • It reuses the builder stage as the base of the final image but strips its tag, keeping all previously installed packages and tools.

  • It starts a new build stage with an empty filesystem, so none of the layers from the golang:1.22-alpine stage are included unless files are explicitly copied with --from.

CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Settings & Objectives
Random Mixed
Questions are selected randomly from all chosen topics, with a preference for those you haven’t seen before. You may see several questions from the same objective or domain in a row.
Rotate by Objective
Questions cycle through each objective or domain in turn, helping you avoid long streaks of questions from the same area. You may see some repeat questions, but the distribution will be more balanced across topics.

Check or uncheck an objective to set which questions you will receive.

Bash, the Crucial Exams Chat Bot
AI Bot