0
0
Flaskframework~10 mins

Docker containerization in Flask - 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 for a Flask app.

Flask
FROM [1]
Drag options to blanks, or click blank then click option'
Aubuntu:20.04
Bnode:latest
Cpython:3.12-slim
Dalpine:latest
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a Node.js or Ubuntu image which is not optimized for Python Flask apps.
2fill in blank
medium

Complete the code to copy the Flask app files into the Docker image.

Flask
COPY [1] /app
Drag options to blanks, or click blank then click option'
Aapp.py
B.
CDockerfile
Drequirements.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Copying only requirements.txt or app.py which misses other needed files.
3fill in blank
hard

Fix the error in the Dockerfile command to install dependencies.

Flask
RUN pip install -r [1]
Drag options to blanks, or click blank then click option'
Arequirements.txt
BDockerfile
Capp.py
Dsetup.py
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to install from app.py or Dockerfile which are not package lists.
4fill in blank
hard

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

Flask
WORKDIR [1]
EXPOSE [2]
Drag options to blanks, or click blank then click option'
A/app
B8080
C5000
D/usr/src/app
Attempts:
3 left
💡 Hint
Common Mistakes
Exposing the wrong port or setting the wrong working directory.
5fill in blank
hard

Fill all three blanks to define the command that runs the Flask app inside the container.

Flask
CMD ["[1]", "[2]", "[3]"]
Drag options to blanks, or click blank then click option'
Apython
Bapp.py
C-m
Dflask
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'flask' directly without python or missing the module flag.