0
0
Dockerdevops~10 mins

Multiple FROM statements 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 to start a multi-stage build with the base image.

Docker
FROM [1]
Drag options to blanks, or click blank then click option'
Anode:14
Bubuntu:20.04
Cpython:3.9
Dalpine:latest
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a heavy image for the first stage unnecessarily increases build size.
2fill in blank
medium

Complete the Dockerfile to name the first build stage.

Docker
FROM alpine:latest AS [1]
Drag options to blanks, or click blank then click option'
Afinal
Bbuilder
Cbase
Druntime
Attempts:
3 left
💡 Hint
Common Mistakes
Using final for the first stage name, which is usually reserved for the last stage.
3fill in blank
hard

Fix the error in the second FROM statement to use the first stage correctly.

Docker
FROM [1] AS final
Drag options to blanks, or click blank then click option'
Aalpine:latest
Bubuntu:20.04
Cbuilder
Dnode:14
Attempts:
3 left
💡 Hint
Common Mistakes
Using a base image name instead of the stage name causes build errors.
4fill in blank
hard

Fill both blanks to copy the built app from the first stage and set the working directory.

Docker
COPY --from=[1] /app/build /app
WORKDIR [2]
Drag options to blanks, or click blank then click option'
Abuilder
B/app
C/usr/src/app
Dfinal
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong stage name or incorrect working directory path.
5fill in blank
hard

Fill all three blanks to complete the multi-stage Dockerfile that builds and runs a Node.js app.

Docker
FROM node:14 AS [1]
WORKDIR [2]
RUN npm install

FROM [3]
COPY --from=[1] [2] [2]
Drag options to blanks, or click blank then click option'
Abuilder
B/usr/src/app
Cnode:14
Dfinal
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing stage names or base images causes build or runtime errors.