DCA · Question #32
DCA Question #32: Real Exam Question with Answer & Explanation
The correct answer is D: Create a config file for each environment.. The best practice for deploying containers with environment-specific configurations, such as different certificates and ports, is to externalize these settings into configuration files.
Question
An application image runs in multiple environments, and each environment uses different certificates and ports, what is the best practice to deploy the containers?
Options
- ACreate a Dockerfile for each environment, specifying ports and ENV variables for certificates.
- BCreate a Dockerfile for each environment, specifying ports and Docker secrets for certificates.
- CCreate images that contain the specific configuration for every environment.
- DCreate a config file for each environment.
Explanation
The best practice for deploying containers with environment-specific configurations, such as different certificates and ports, is to externalize these settings into configuration files.
Common mistakes.
- A. Creating a Dockerfile for each environment leads to multiple similar images, violating the 'build once, run anywhere' principle and increasing maintenance overhead.
- B. While Docker secrets are suitable for sensitive data, creating separate Dockerfiles for each environment to embed these is inefficient and contradicts the goal of a single, reusable image.
- C. Creating distinct images for every environment results in image proliferation, making the build and deployment process less efficient and harder to manage due to redundant image builds.
Concept tested. Container configuration best practices and immutability
Topics
Community Discussion
No community discussion yet for this question.