0
0
Microservicessystem_design~10 mins

Dockerfile for microservices - 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 a Node.js microservice.

Microservices
FROM [1]
Drag options to blanks, or click blank then click option'
Amysql:8
Bpython:3.12
Cubuntu:latest
Dnode:18-alpine
Attempts:
3 left
💡 Hint
Common Mistakes
Using a base image for a different language or service like Python or MySQL.
Using a heavy base image when a lightweight one is preferred.
2fill in blank
medium

Complete the Dockerfile command to copy the application source code into the container.

Microservices
COPY [1] /app
Drag options to blanks, or click blank then click option'
Apackage.json
B.
Cnode_modules
DDockerfile
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 using npm.

Microservices
RUN npm [1]
Drag options to blanks, or click blank then click option'
Ainstall
Bstart
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 standard npm command.
4fill in blank
hard

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

Microservices
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
Setting a working directory that doesn't match the copied files.
Exposing the wrong port that the app does not listen on.
5fill in blank
hard

Fill the blanks to define the command that starts the Node.js microservice.

Microservices
CMD ["[1]", "[2]"]
Drag options to blanks, or click blank then click option'
Anode
Bapp.js
Cserver.js
Dnpm
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'npm' as the first command in this JSON array format.
Using 'app.js' when the main file is 'server.js' or vice versa.