在daemon.json中更改Windows的“hosts”/“-h”Docker

我正在尝试在Docker for Windows上更改daemon.json(安装了Windows 10 Aniversary最新更新)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标志启动,并且json配置未与它合并.

那么,我们如何通过json文件或更改dockerd启动参数来更改这些设置?

解决方法

你有一个issue 22339相似的案例:

This is expected; you cannot specify options 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 explicitly don’t “merge” these configurations.

或者添加docker.conf

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

但官方立场仍然是:

There’s no bug in the systemd configuration,to override defaults in a systemd unit file,you can use a drop-in file,as described in “07001”.

Producing an error if both a flag and an option in daemon.json are provided was a design decision when implementing that (in general,flags should always have precedence over configuration files); automatically merging options was not an option,as this would lead to unexpected results (was the intent to override an option,or to add to an option?)

issue 21559被拒绝,issue 21559.

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...