ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 462 - DOP-C01 discussion

Report
Export

When building a Docker image, you are searching through a persistent data volume's logs to provide parameters for the next build. You execute the following command. Which of the operations will cause a failure of the Docker RUNcommand? RUN cat ./data/log/*.error | grep service_status | grep ERROR

A.
the first grep command
Answers
A.
the first grep command
B.
any one of them
Answers
B.
any one of them
C.
the second grep command
Answers
C.
the second grep command
D.
the cat command
Answers
D.
the cat command
Suggested answer: C

Explanation:

Some RUN commands depend on the ability to pipe the output of one command into another, using the pipe character (|), as in the following example:

RUN wget -O - https://some.site | wc -l > /number

Docker executes these commands using the /bin/sh -c interpreter, which only evaluates the exit code of the last operation in the pipe to determine success. In the example above this build step succeeds and produces a new image so long as the wc - lcommand succeeds, even if the wget command fails.

Reference:

https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run

asked 16/09/2024
Ankur Patel
42 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first