0
0
Dockerdevops~10 mins

Builder pattern before multi-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 specify the base image for the build stage.

Docker
FROM [1] AS builder
Drag options to blanks, or click blank then click option'
Anode:18-alpine
Bubuntu:latest
Cpython:3.12-slim
Dalpine:3.18
Attempts:
3 left
💡 Hint
Common Mistakes
Using a base image without Node.js when building a Node app.
Choosing a heavy image like full Ubuntu unnecessarily.
2fill in blank
medium

Complete the command to copy package.json and package-lock.json into the builder stage.

Docker
COPY [1] ./
Drag options to blanks, or click blank then click option'
Adist/
Bpackage*.json
Cnode_modules/
Dsrc/
Attempts:
3 left
💡 Hint
Common Mistakes
Copying the entire source folder instead of just package files.
Copying node_modules folder which should be built inside the container.
3fill in blank
hard

Fix the error in the RUN command to install dependencies in the builder stage.

Docker
RUN npm [1]
Drag options to blanks, or click blank then click option'
Astart
Bbuild
Cinstall
Dtest
Attempts:
3 left
💡 Hint
Common Mistakes
Using npm start which runs the app instead of installing.
Using npm build which is not a valid npm command.
4fill in blank
hard

Fill both blanks to copy built files from the builder stage to the final image.

Docker
COPY --from=[1] [2] ./app/
Drag options to blanks, or click blank then click option'
Abuilder
B/app/dist
C/dist
Dfinal
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong stage name in --from.
Copying from a wrong or non-existent folder.
5fill in blank
hard

Fill all three blanks to define the final image base, set working directory, and expose port.

Docker
FROM [1]
WORKDIR [2]
EXPOSE [3]
Drag options to blanks, or click blank then click option'
Anode:18-alpine
B/app
C3000
Dubuntu:latest
Attempts:
3 left
💡 Hint
Common Mistakes
Using a heavy base image for final stage.
Forgetting to set working directory.
Exposing wrong or no port.