0
0
Dockerdevops~10 mins

Multi-stage builds concept in Docker - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the Dockerfile line to start a new build stage named 'builder'.

Docker
FROM golang:1.20 AS [1]
Drag options to blanks, or click blank then click option'
Abuilder
Bruntime
Cbase
Dfinal
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'final' as the first stage name instead of 'builder'.
Omitting the stage name after AS.
2fill in blank
medium

Complete the COPY command to copy files from the 'builder' stage.

Docker
COPY --from=[1] /app/myapp /usr/local/bin/myapp
Drag options to blanks, or click blank then click option'
Aruntime
Bfinal
Cbase
Dbuilder
Attempts:
3 left
💡 Hint
Common Mistakes
Using a stage name that does not exist.
Forgetting to use the --from option.
3fill in blank
hard

Fix the error in the Dockerfile line to correctly name the final stage.

Docker
FROM alpine AS [1]
Drag options to blanks, or click blank then click option'
Abuilder
Bbuild
Cfinal
Dcompile
Attempts:
3 left
💡 Hint
Common Mistakes
Naming the final stage 'builder' which is confusing.
Using inconsistent stage names.
4fill in blank
hard

Fill both blanks to complete the multi-stage build Dockerfile snippet.

Docker
RUN go build -o /app/myapp [1] && \
COPY --from=[2] /app/myapp /usr/local/bin/myapp
Drag options to blanks, or click blank then click option'
A./src
Bbuilder
Cfinal
D./app
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong source path in the build command.
Copying from the wrong stage name.
5fill in blank
hard

Fill all three blanks to complete the multi-stage Dockerfile for a Go app.

Docker
FROM golang:1.20 AS [1]
WORKDIR /src
COPY . .
RUN go build -o /app/myapp [2]
FROM alpine AS [3]
COPY --from=builder /app/myapp /usr/local/bin/myapp
CMD ["myapp"]
Drag options to blanks, or click blank then click option'
Abuilder
B./src
Cfinal
Druntime
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up stage names.
Using incorrect source path in build command.