gpt4 book ai didi

docker - 在 daemon.json 中更改 "hosts"/"-h"Docker for Windows

转载 作者:IT老高 更新时间:2023-10-28 21:23:28 30 4
gpt4 key购买 nike

我正在尝试更改 Docker Desktop 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 "Custom Docker daemon options".

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?)

PR 27473被拒绝,因为 issue 21559 .

关于docker - 在 daemon.json 中更改 "hosts"/"-h"Docker for Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41517970/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com