200-901 Question 120
Select 3You are working on a Python application in your local development environment. You want to test the application using a containerized database without affecting your local system configuration. Which of the following steps should you perform to utilize a Docker image for this purpose?
- A
Pull the required database Docker image from a container registry like Docker Hub.
- B
Use the
docker buildcommand to create a custom Docker image for your Python application. - C
Run the database Docker container using the
docker runcommand with appropriate ports and environment variables. - D
Install the database software directly on your local machine for faster integration.
- E
Use Docker Compose to define and run both the Python application and database services together.
Show answer and explanation
Correct answers: A, C, E
Explanation
To utilize a Docker image for a database in your local developer environment, you need to pull the appropriate image, run the container to start the database service, and optionally use Docker Compose to manage the setup if multiple containers (such as an app and a database) are involved. This approach ensures isolation and avoids changes to your local system configuration.
- A. Correct.
Pulling the required Docker image is the first step to use a pre-built containerized database. This allows you to download the database image from a public or private registry.
- B. Incorrect.
Building a custom image for your Python application is unrelated to the task of utilizing a database Docker image and is not required in this scenario.
- C. Correct.
Running the database container using
docker runenables you to start the database service and configure it, such as by exposing ports or setting environment variables. - D. Incorrect.
Installing the database software on your local machine contradicts the goal of using Docker to avoid affecting your local configuration.
- E. Correct.
Using Docker Compose is a good practice to define and manage multi-container applications, such as a Python app that depends on a database.