0
0
Dockerdevops~10 mins

Multi-stage for different environments 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 build
Drag options to blanks, or click blank then click option'
Anode:14
Bubuntu:latest
Cpython:3.9
Dalpine:3.15
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a base image that is not suitable for building Node.js apps.
2fill in blank
medium

Complete the Dockerfile line to copy only production dependencies in the final stage.

Docker
COPY --from=build /app/[1] ./
Drag options to blanks, or click blank then click option'
Anode_modules
Bpackage.json
Csrc
Ddist
Attempts:
3 left
💡 Hint
Common Mistakes
Copying source code instead of dependencies.
3fill in blank
hard

Fix the error in the Dockerfile line that sets the environment variable for production.

Docker
ENV NODE_ENV=[1]
Drag options to blanks, or click blank then click option'
Adevelopment
Btest
Cproduction
Dstaging
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'development' or 'test' instead of 'production'.
4fill in blank
hard

Fill both blanks to complete the multi-stage Dockerfile for build and production stages.

Docker
FROM [1] AS build
FROM [2] AS production
Drag options to blanks, or click blank then click option'
Anode:16
Bnode:alpine
Cpython:3.10
Dubuntu:20.04
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same image for both stages or using unrelated images.
5fill in blank
hard

Fill all three blanks to complete the Dockerfile snippet that copies build output and sets the command.

Docker
COPY --from=[1] /app/[2] ./
CMD ["[3]"]
Drag options to blanks, or click blank then click option'
Abuild
Bdist
Cnode
Dsrc
Attempts:
3 left
💡 Hint
Common Mistakes
Copying from wrong stage or folder, or using wrong command.