200-901 exam dumps

200-901 practice question 119 of 204

Cisco DevNet Associate. Associate level, Cisco. Free question with the correct answer and a full explanation.

200-901 Question 119

Single answer

You are reviewing the following Dockerfile for a Python-based application:

FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . ./
CMD ["python", "app.py"]

What is the purpose of the RUN pip install --no-cache-dir -r requirements.txt instruction in this Dockerfile?

  1. A

    It sets the working directory to /app.

  2. B

    It installs the Python dependencies listed in the requirements.txt file.

  3. C

    It copies the requirements.txt file into the container.

  4. D

    It specifies the command to run the application.

Show answer and explanation

Correct answer: B

Explanation

The RUN pip install --no-cache-dir -r requirements.txt instruction in the Dockerfile is used to install the Python dependencies specified in the requirements.txt file. This step ensures that the runtime environment inside the container has all the necessary libraries for the Python application to function correctly. The other instructions in the Dockerfile (e.g., WORKDIR, COPY, and CMD) serve different purposes, such as setting the working directory, copying files, and defining the default command to run the application.

  • A. Incorrect.

    This option is incorrect because the WORKDIR instruction, not the RUN instruction, sets the working directory to /app.

  • B. Correct.

    This option is correct because the RUN pip install --no-cache-dir -r requirements.txt instruction installs the Python dependencies listed in the requirements.txt file, which is a common step in preparing a Python-based application.

  • C. Incorrect.

    This option is incorrect because the COPY requirements.txt ./ instruction handles copying the requirements.txt file into the container, not the RUN instruction.

  • D. Incorrect.

    This option is incorrect because the CMD instruction specifies the command to run the application, not the RUN instruction.

Timed practice exam

Take a 200-901 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam