nerdexam
Cisco

200-901 · Question #405

Drag and Drop Question Refer to the exhibit. Drag and drop the actions from the left that the contents of this Dockerfile accomplish onto the right. Not all options are used. Answer:

The correct answer is Pull the image myImage.; Establish a volume whose root is "/data".; Put the user in a shell inside the container.. This question tests the understanding of fundamental Dockerfile instructions by requiring the test-taker to match common Dockerfile actions to their logical sequence in an image build process.

Application Deployment and Security

Question

Drag and Drop Question Refer to the exhibit. Drag and drop the actions from the left that the contents of this Dockerfile accomplish onto the right. Not all options are used. Answer:

Exhibit

200-901 question #405 exhibit

Answer Area

Drag items

Inject the image myImage.Pull the image myImage.Execute the "data" script under "/bin/sh".Establish a volume whose root is "/data".Put the user in a shell inside the container.

Correct arrangement

  • Pull the image myImage.
  • Establish a volume whose root is "/data".
  • Put the user in a shell inside the container.

Explanation

This question tests the understanding of fundamental Dockerfile instructions by requiring the test-taker to match common Dockerfile actions to their logical sequence in an image build process.

Approach. Based on the logical flow and common instructions found in a Dockerfile, the correct interaction is to drag the following actions to their respective steps:

  1. Drag 'Pull the image myImage.' to 'step 1'.

    • Reasoning: The FROM instruction is almost always the first command in a Dockerfile, specifying the base image. When a Dockerfile with FROM myImage is processed, Docker first pulls myImage if it's not already available locally. Thus, 'Pull the image myImage' is the foundational first step.
  2. Drag 'Establish a volume whose root is "/data".' to 'step 2'.

    • Reasoning: The VOLUME instruction (VOLUME /data) defines a mount point for persistent data. This is typically done after the base image is established and before application-specific commands or entrypoints, ensuring the volume is part of the image definition.
  3. Drag 'Execute the "data" script under "/bin/sh".' to 'step 3'.

    • Reasoning: This action corresponds to CMD or ENTRYPOINT instructions (e.g., CMD ["/bin/sh", "data"] or ENTRYPOINT ["/bin/sh", "data"]) which define the default command to execute when a container built from the image is run. This usually occurs towards the end of a Dockerfile, setting up the primary function of the container.

Common mistakes.

  • common_mistake. The following options are incorrect for the given steps or are not standard Dockerfile actions:

  • 'Inject the image myImage.': This phrasing does not correspond to any standard Dockerfile instruction. The FROM instruction specifies a base image, which is then 'pulled' and used as the foundation, not 'injected' in this context.

  • 'Put the user in a shell inside the container.': While it's possible for a container's default command (CMD or ENTRYPOINT) to be a shell, or for a user to interactively run a shell in a container, a Dockerfile itself primarily defines the image and its default command, not literally 'putting a user in a shell' as a build step. The option 'Execute the "data" script under "/bin/sh"' is a more specific and common action defined by CMD or ENTRYPOINT that dictates the container's primary process, rather than initiating an interactive user session at build time.

Concept tested. Understanding of core Dockerfile instructions, their purpose, and the typical order of operations during a Docker image build process, specifically FROM, VOLUME, and CMD/ENTRYPOINT.

Topics

#Dockerfile#Docker#Containerization#Application Deployment

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice