DCA practice question 11 of 25

An application image runs in multiple environments, with each environment using different certificates and ports. Is this a way to provision configuration to containers at runtime? Solution: Provision a Docker config object for each environment.

Full set: 191 questions
Answer options
A: Yes Correct answer
B: No
Correct Answer:
A. Yes
Explanation

Docker configs are a feature designed specifically for managing non-sensitive application configuration data for services running in a Docker Swarm. They allow you to decouple configuration from the application image, which is a containerization best practice. By creating a separate config object for each environment (e.g., dev-certs, prod-certs), you can mount the appropriate configuration into the service at runtime. This enables the use of a single, immutable application image across multiple environments, with each environment receiving its specific certificates, ports, or other settings when the service is deployed.

Why Incorrect

B: This is incorrect because using Docker configs is the standard, intended method for managing environment-specific, non-sensitive configuration files for services in a Docker Swarm.

References

1. Docker Docs, "Store configuration data using Docker Configs". The documentation states, "Docker configs are useful for storing non-sensitive information... You can add or remove configs from a service at any time." This directly supports the proposed solution. (Docker Inc., "Store configuration data using Docker Configs", docs.docker.com/engine/swarm/configs/)

2. Docker Docs, docker config create command reference. The purpose is described as "Creates a config from a file or STDIN." This is the command used to implement the solution. (Docker Inc., "docker config create", docs.docker.com/engine/reference/commandline/configcreate/)

3. Docker Docs, docker service create command reference. The --config flag is detailed as the mechanism to "Specify configuration file", attaching the created config object to a service at runtime. (Docker Inc., "docker service create", docs.docker.com/engine/reference/commandline/servicecreate/#specifying-configuration-files---config)

Scroll to Top