微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在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.jb51.cc/js/156894.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐