在daemon.json中更改Windows的“hosts”/“-h”Docker
我试图更改Docker for Windows(安装Windows 10 Aniversary最新更新)daemon.json 1.13.0-rc5,所以我可以更改"hosts": []
设置是这样的:
{ "hosts": [ "tcp://0.0.0.0", "http://0.0.0.0" ] }
但是,使用设置应用程序更改设置后,我得到了这个错误:
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])
看起来守护进程已经开始与-H
标志和jsonconfiguration不与它合并。
那么,我们如何通过json文件更改这些设置或更改dockerd启动参数?
问题22339有类似的情况:
这是预料之中的; 您不能将选项指定为标志和configuration文件(
daemon.json
)。
如果你改变你的DOCKER_OPTS
到DOCKER_OPTS=""
然后重新启动,那么它应该工作。 我们明确不要“合并”这些configuration。
或者添加在docker.conf中
[Service] ExecStart= ExecStart=/path/to/dockerd # or ExecStart=/path/to/dockerd daemon
但官方的立场仍然是:
systemd
configuration中没有任何错误可以覆盖systemd
单元文件中的默认值,您可以使用drop-in文件,如“ 自定义Docker守护程序选项 ”中所述。如果提供了
daemon.json
中的标志和选项,那么产生一个错误是一个devise决策(通常,标志总是优先于configuration文件)。 自动合并选项不是一个选项,因为这会导致意想不到的结果(意图覆盖一个选项,或添加到一个选项?)
PR 27473被拒绝, 问题21559 。