Bird
0
0

Which Dockerfile instruction correctly starts a new build stage named 'builder'?

easy📝 Syntax Q3 of 15
Spring Boot - Docker and Deployment
Which Dockerfile instruction correctly starts a new build stage named 'builder'?
ACOPY openjdk:17 AS builder
BFROM openjdk:17 AS builder
CRUN openjdk:17 AS builder
DCMD openjdk:17 AS builder
Step-by-Step Solution
Solution:
  1. Step 1: Recall Dockerfile syntax for stages

    The FROM instruction starts a new build stage and can be named with AS.
  2. Step 2: Identify correct syntax

    Only FROM supports 'AS builder' syntax; RUN, COPY, CMD do not.
  3. Final Answer:

    FROM openjdk:17 AS builder -> Option B
  4. Quick Check:

    Stage start syntax = FROM ... AS name [OK]
Quick Trick: Use FROM ... AS to name build stages in Dockerfile [OK]
Common Mistakes:
  • Using RUN or COPY to start a stage
  • Forgetting AS keyword
  • Misplacing stage name after instruction

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes