0
0
Dockerdevops~10 mins

Development container patterns 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 set the base image for a development container.

Docker
FROM [1]
Drag options to blanks, or click blank then click option'
Apython:3.12-slim
Bnode:18-alpine
Cubuntu:latest
Dnginx:stable
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a production-only image like nginx for development.
2fill in blank
medium

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

Docker
COPY [1] /app
Drag options to blanks, or click blank then click option'
A./
B./src
C/src
Dsrc/
Attempts:
3 left
💡 Hint
Common Mistakes
Using absolute paths like /src which don't exist in the build context.
3fill in blank
hard

Fix the error in the Dockerfile command to install dependencies using npm.

Docker
RUN npm [1]
Drag options to blanks, or click blank then click option'
Ainstall
Bupdate
Cupgrade
Dbuild
Attempts:
3 left
💡 Hint
Common Mistakes
Using npm update which updates packages but does not install new ones.
4fill in blank
hard

Fill both blanks to expose port 3000 and set the default command to start the app.

Docker
EXPOSE [1]
CMD ["npm", "[2]"]
Drag options to blanks, or click blank then click option'
A3000
Bstart
Cbuild
D8080
Attempts:
3 left
💡 Hint
Common Mistakes
Exposing the wrong port or using npm build which only compiles code.
5fill in blank
hard

Fill all three blanks to create a volume mount for live code editing and set environment variable for development mode.

Docker
VOLUME ["[1]"]
ENV NODE_ENV=[2]
CMD ["npm", "[3]"]
Drag options to blanks, or click blank then click option'
A/app
Bdevelopment
Cstart
D/src
Attempts:
3 left
💡 Hint
Common Mistakes
Mounting the wrong directory or forgetting to set NODE_ENV for development.