0
0
NestJSframework~10 mins

Docker containerization in NestJS - Interactive Code Practice

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

Complete the code to specify the base image for a NestJS Docker container.

NestJS
FROM [1]
Drag options to blanks, or click blank then click option'
Aubuntu:latest
Bpython:3.12
Cnode:18-alpine
Dnginx:alpine
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a base image that does not have Node.js installed.
Using a heavy image like full Ubuntu unnecessarily.
2fill in blank
medium

Complete the code to copy the NestJS application files into the Docker image.

NestJS
COPY [1] /app
Drag options to blanks, or click blank then click option'
A.
Bpackage.json
Cdist
Dnode_modules
Attempts:
3 left
💡 Hint
Common Mistakes
Copying only package.json without source files.
Copying node_modules which should be installed inside the container.
3fill in blank
hard

Fix the error in the Dockerfile command to install dependencies.

NestJS
RUN npm [1]
Drag options to blanks, or click blank then click option'
Astart
Binstall
Cbuild
Dtest
Attempts:
3 left
💡 Hint
Common Mistakes
Using npm start which runs the app, not installs packages.
Using npm build which is not a valid npm command.
4fill in blank
hard

Fill both blanks to expose the correct port and set the working directory.

NestJS
WORKDIR [1]
EXPOSE [2]
Drag options to blanks, or click blank then click option'
A/app
B3000
C/usr/src/app
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Exposing port 8080 which is not the default NestJS port.
Setting working directory to a folder not used in the Dockerfile.
5fill in blank
hard

Fill all three blanks to run the NestJS app in production mode.

NestJS
CMD ["npm", "[1]", "[2]", "[3]"]
Drag options to blanks, or click blank then click option'
Arun
Bstart
Cprod
Dtest
Attempts:
3 left
💡 Hint
Common Mistakes
Using npm start without run keyword.
Using test instead of prod for production.