Bird
0
0

Given this Dockerfile snippet in a CI/CD pipeline:

medium📝 Command Output Q13 of 15
Docker - in CI/CD
Given this Dockerfile snippet in a CI/CD pipeline:
FROM python:3.12-slim
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
CMD ["python", "app.py"]

What happens when the image runs?
AIt installs Python 3.12 and runs app.py automatically.
BIt copies files but does not install dependencies.
CIt runs app.py without installing dependencies.
DIt fails because the WORKDIR is missing.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the Dockerfile commands

    The image uses Python 3.12, copies files to /app, sets /app as working directory, installs dependencies, and sets the command to run app.py.
  2. Step 2: Understand the effect when running the container

    When started, the container runs python app.py with dependencies installed.
  3. Final Answer:

    It installs Python 3.12 and runs app.py automatically. -> Option A
  4. Quick Check:

    Dockerfile installs dependencies and runs app.py = A [OK]
Quick Trick: RUN installs, CMD runs app [OK]
Common Mistakes:
  • Ignoring RUN command effects
  • Assuming WORKDIR is missing
  • Thinking dependencies are not installed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Docker Quizzes