200-901 exam dumps

200-901 practice question 121 of 204

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

200-901 Question 121

Select 3

You are developing a Python-based microservice application and want to run it consistently in your local development environment using Docker. You have created a Dockerfile for the application. Which of the following steps must you take to successfully build and run the Docker container in your local environment?

  1. A

    Use the 'docker build' command to create a Docker image from the Dockerfile.

  2. B

    Use the 'docker push' command to upload the image to a public Docker registry.

  3. C

    Use the 'docker run' command to start a container from the built image.

  4. D

    Ensure the Dockerfile is located in the same directory where you run the 'docker build' command.

  5. E

    Use the 'docker pull' command to retrieve the image from a remote repository before running it.

Show answer and explanation

Correct answers: A, C, D

Explanation

To run a Docker container for a local application, you need to build the Docker image from the Dockerfile using the 'docker build' command. Then, use the 'docker run' command to start a container from the built image. The Dockerfile must be in the same directory as the 'docker build' command, as Docker uses the current directory as the build context. Uploading the image to a public registry or pulling it from a remote repository is optional and only required for sharing or retrieving the image, respectively.

  • A. Correct.

    Correct. The 'docker build' command is used to create a Docker image from the Dockerfile, which is essential for running the application in a container.

  • B. Incorrect.

    Incorrect. Uploading the image to a public Docker registry is not mandatory for running the container locally. This step is only necessary if you want to share the image with others.

  • C. Correct.

    Correct. The 'docker run' command is used to start a container from the built image, allowing you to run your application inside the container.

  • D. Correct.

    Correct. The Dockerfile must be in the same directory where the 'docker build' command is executed, as Docker looks for the Dockerfile in the current context by default.

  • E. Incorrect.

    Incorrect. The 'docker pull' command is used to retrieve images from a remote repository, but it is not needed if you have already built the image locally.

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