Change the "hosts" / "-h" Docker for Windows in daemon.json

I am trying to change daemon.json to Docker for Windows (recent updates for Windows 10 with installed updates) 1.13.0-rc5, so I can change the "hosts": [] setting as follows:

 { "hosts": [ "tcp://0.0.0.0", "http://0.0.0.0" ] } 

However, after changing the settings using the settings application, I got this error:

 Docker daemon failed with message: unable to configure the Docker daemon with file C:\ProgramData\docker\config\daemon.json: the following directives are specified both as a flag and in the configuration file: hosts: (from flag: [npipe:////./pipe/docker_engine_windows], from file: [tcp://0.0.0.0 http://0.0.0.0]) 

It looks like the daemon is already running with the -H flag, and the json config does not merge with it.

So, how can we change these settings using either a json file or changing dockerd startup options?

+6
source share
1 answer

You have a similar case with issue 22339 :

Expected; you cannot specify parameters both as a flag and in the configuration file ( daemon.json ).
If you change your DOCKER_OPTS to DOCKER_OPTS="" and restart, then it should work. We clearly do not "combine" these configurations.

Or add to docker.conf

 [Service] ExecStart= ExecStart=/path/to/dockerd # or ExecStart=/path/to/dockerd daemon 

But the official position remains:

There is no error in the systemd configuration, to override the default values ​​in the unit systemd file, you can use the drop-down file as described in " Docker demonstrator options .

Getting an error if a flag and parameter are provided in daemon.json is a constructive solution when implementing it (in general, flags should always take precedence over configuration files); automatic merging of options was not an option, as this would lead to unexpected results (was there an intention to override the option or add to the option?)

PR 27473 was rejected, for issue 21559 .

+1
source

Source: https://habr.com/ru/post/1013853/


All Articles