Bird
0
0

You wrote this Dockerfile for your Flask app:

medium📝 Debug Q14 of 15
Flask - Deployment
You wrote this Dockerfile for your Flask app:
FROM python:3.12-slim
COPY app.py /app/
CMD ["python", "app.py"]

When you run the container, the app crashes with "ModuleNotFoundError: flask". What is the problem?
AFlask is not installed inside the container
Bapp.py is not copied to the container
CCMD syntax is incorrect
DPython version 3.12-slim does not support Flask
Step-by-Step Solution
Solution:
  1. Step 1: Check Dockerfile for dependency installation

    No RUN command installs Flask or dependencies inside container.
  2. Step 2: Understand error cause

    ModuleNotFoundError means Flask package missing in container environment.
  3. Final Answer:

    Flask is not installed inside the container -> Option A
  4. Quick Check:

    Missing Flask install causes ModuleNotFoundError = C [OK]
Quick Trick: Always RUN pip install for dependencies inside Dockerfile [OK]
Common Mistakes:
MISTAKES
  • Assuming Flask is preinstalled in base image
  • Thinking app.py copy is missing
  • Believing CMD syntax causes import errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes