nerdexam
Docker

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.

Submitted by ahmad_uae· Apr 18, 2026Installation and Configuration

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)
  • B
    94% (30)
  • C
    3% (1)
  • D
    3% (1)

Why each option

The recommended and platform-independent method for configuring Docker daemon flags and environment variables is through the `daemon.json` file.

ASet the configuration options using the ENV variable

Setting configuration options via environment variables is generally for temporary overrides or client-side settings, not for persistent, daemon-wide configuration.

BSet the configuration options in '/etc/docker/daemon.json'Correct

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.

CSet the configuration DOCKER_OPTS in '/etc/default/docker'

Modifying `DOCKER_OPTS` in `/etc/default/docker` is a legacy or distribution-specific method for configuring the daemon, making it not platform-independent.

DUsing 'docker config' to set the configuration options.

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

#Docker Daemon#Configuration#daemon.json#Platform Independent

Community Discussion

No community discussion yet for this question.

Full DCA Practice