DCA · Question #38
What is the recommended way to configure the daemon flags and environment variables for your Docker daemon in a platform independent way?
The correct answer is B. Set the configuration options in '/etc/docker/daemon.json'. The recommended and platform-independent method for configuring Docker daemon flags and environment variables is through the daemon.json file.
Question
What is the recommended way to configure the daemon flags and environment variables for your Docker daemon in a platform independent way?
Options
- ASet the configuration options using the ENV variable
- BSet the configuration options in '/etc/docker/daemon.json'
- CSet the configuration DOCKER_OPTS in '/etc/default/docker'
- DUsing 'docker config' to set the configuration options.
How the community answered
(32 responses)- B94% (30)
- C3% (1)
- D3% (1)
Why each option
The recommended and platform-independent method for configuring Docker daemon flags and environment variables is through the `daemon.json` file.
Setting configuration options via environment variables is generally for temporary overrides or client-side settings, not for persistent, daemon-wide configuration.
The `daemon.json` file, located in `/etc/docker/` (or platform-equivalent paths), provides a standardized, JSON-formatted way to configure all Docker daemon settings. This method is platform-independent because the Docker daemon parses this file directly, regardless of the underlying operating system's init system.
Modifying `DOCKER_OPTS` in `/etc/default/docker` is a legacy or distribution-specific method for configuring the daemon, making it not platform-independent.
The `docker config` command is used for managing non-sensitive configuration data for services within a Docker Swarm, not for configuring the Docker daemon itself.
Concept tested: Docker daemon configuration methods
Source: https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file
Topics
Community Discussion
No community discussion yet for this question.