0
0
Dockerdevops~10 mins

Copying from build stage to final stage 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 copy files from the build stage to the final stage.

Docker
COPY --from=[1] /app/build /app
Drag options to blanks, or click blank then click option'
Astage1
Bfinal
Cbuilder
Dsource
Attempts:
3 left
💡 Hint
Common Mistakes
Using the final stage name instead of the build stage.
Using an undefined stage name.
2fill in blank
medium

Complete the Dockerfile to name the build stage correctly.

Docker
FROM node:18 AS [1]
Drag options to blanks, or click blank then click option'
Adeploy
Bruntime
Cfinal
Dbuilder
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'final' or 'runtime' which are usually for the last stage.
3fill in blank
hard

Fix the error in the COPY command to correctly copy from the build stage.

Docker
COPY --from=[1] /usr/src/app/dist /app
Drag options to blanks, or click blank then click option'
Afinal
Bbuilder
Csource
Dlatest
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'final' or 'latest' which are not build stage names.
4fill in blank
hard

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

Docker
FROM python:3.12 AS [1]
RUN pip install -r requirements.txt
FROM alpine:latest AS [2]
COPY --from=[1] /app /app
Drag options to blanks, or click blank then click option'
Abuilder
Bfinal
Cruntime
Dbuild
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up stage names or using undefined names.
5fill in blank
hard

Fill all three blanks to complete the Dockerfile for copying build output to final stage.

Docker
FROM golang:1.20 AS [1]
WORKDIR /src
RUN go build -o app .
FROM scratch AS [2]
COPY --from=[1] [3] /app
Drag options to blanks, or click blank then click option'
Abuilder
Bfinal
C/src/app
D/app
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong stage names or wrong source path for COPY.