Bird
0
0

Which of the following is the correct way to start a Django app inside a Dockerfile?

easy📝 Syntax Q12 of 15
Django - Deployment and Production
Which of the following is the correct way to start a Django app inside a Dockerfile?
AEXPOSE python manage.py runserver
BRUN python manage.py runserver
CCMD python manage.py runserver 0.0.0.0:8000
DCOPY python manage.py runserver
Step-by-Step Solution
Solution:
  1. Step 1: Identify Dockerfile commands

    CMD sets the command to run when the container starts.
  2. Step 2: Match command to Django app start

    Running 'python manage.py runserver 0.0.0.0:8000' starts the Django server accessible outside the container.
  3. Final Answer:

    CMD python manage.py runserver 0.0.0.0:8000 -> Option C
  4. Quick Check:

    CMD runs app on container start = A [OK]
Quick Trick: Use CMD to run Django server with 0.0.0.0 binding [OK]
Common Mistakes:
MISTAKES
  • Using RUN instead of CMD to start server
  • Misusing EXPOSE as a command
  • Confusing COPY with execution commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes