Bird
0
0

What is the role of the EXPOSE instruction in a Dockerfile for a Flask application?

easy📝 Conceptual Q1 of 15
Flask - Deployment
What is the role of the EXPOSE instruction in a Dockerfile for a Flask application?
AIt copies the Flask app files into the container
BIt sets environment variables for the Flask app
CIt installs Python dependencies inside the container
DIt tells Docker which port the container listens on at runtime
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of EXPOSE in Dockerfile

    The EXPOSE instruction informs Docker which network port the container will listen on when running.
  2. Step 2: Differentiate from other Dockerfile instructions

    Copying files is done by COPY, installing dependencies by RUN pip install, and environment variables by ENV. None of these are related to EXPOSE.
  3. Final Answer:

    It tells Docker which port the container listens on at runtime -> Option D
  4. Quick Check:

    EXPOSE = Port declaration [OK]
Quick Trick: EXPOSE declares container ports, not copies or installs [OK]
Common Mistakes:
MISTAKES
  • Confusing EXPOSE with COPY or RUN commands
  • Thinking EXPOSE sets environment variables
  • Assuming EXPOSE installs dependencies

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes