Final answer:
The correct answer to change the default DNS settings for the Docker daemon is by editing the /etc/docker/daemon.json file to include the "dns" key with the desired DNS server addresses as an array. After saving the file, the Docker service must be restarted to apply the changes.
Step-by-step explanation:
To change the default DNS settings for the Docker daemon, you need to modify the Docker daemon configuration. The correct method to set the DNS server for the Docker daemon is to use the dockerd command with the --dns flag. You would typically edit the daemon configuration file, which could be located at /etc/docker/daemon.json, and add the DNS settings there.
Here's an example of how you might specify the DNS servers in the daemon.json file:
{
"dns": ["8.8.8.8", "8.8.4.4"]
}
After making these changes, you would need to restart the Docker daemon to apply them. You can restart the Docker service using the following command:
sudo systemctl restart docker
Note that directly using the dockerd command to change the DNS setting would typically be done at daemon start-up, not via modification of the configuration file. Documentation and Docker version specifics should always be checked, as command-line options and configuration file approaches may vary.