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

前端之家收集整理的这篇文章主要介绍了在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.

原文链接:https://www.f2er.com/js/156894.html

猜你在找的JavaScript相关文章