0
0
Microservicessystem_design~10 mins

Docker basics review in Microservices - 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 in a Dockerfile.

Microservices
FROM [1]
Drag options to blanks, or click blank then click option'
ACOPY . /app
BRUN apt-get update
Cubuntu:latest
DEXPOSE 80
Attempts:
3 left
💡 Hint
Common Mistakes
Using RUN or COPY instead of a base image after FROM.
2fill in blank
medium

Complete the Dockerfile command to copy files from the host to the container.

Microservices
COPY [1] /app
Drag options to blanks, or click blank then click option'
A/app
B.
CRUN apt-get install
DEXPOSE 8080
Attempts:
3 left
💡 Hint
Common Mistakes
Using container paths as source instead of host paths.
3fill in blank
hard

Fix the error in the Dockerfile command to expose a port.

Microservices
EXPOSE [1]
Drag options to blanks, or click blank then click option'
A80
Beighty
Cport 80
D8080/tcp
Attempts:
3 left
💡 Hint
Common Mistakes
Writing port names or including protocol in EXPOSE command.
4fill in blank
hard

Fill both blanks to run a command and set the working directory in a Dockerfile.

Microservices
WORKDIR [1]
RUN [2]
Drag options to blanks, or click blank then click option'
A/app
Bnpm install
Capt-get update
D/usr/src/app
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong directory paths or commands that don't install dependencies.
5fill in blank
hard

Fill all three blanks to define environment variables, expose a port, and specify the command to run.

Microservices
ENV [1]=[2]
EXPOSE [3]
CMD ["node", "server.js"]
Drag options to blanks, or click blank then click option'
ANODE_ENV
Bproduction
C3000
Ddevelopment
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong environment variable names or invalid port numbers.