2017-01-07 2 views
6

J'essaie de changer daemon.json sur Docker pour Windows (dernières mises à jour de Windows 10 Aniversary installées) 1.13.0-rc5 afin que je puisse changer le réglage "hosts": [] comme ceci:Modifier "hosts"/"-h" Docker pour Windows dans daemon.json

{ 
    "hosts": [ 
    "tcp://0.0.0.0", 
    "http://0.0.0.0" 
    ] 
} 

Cependant, changer après les paramètres à l'aide de l'application des paramètres que je suis cette erreur:

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

on dirait que le démon est déjà commencé avec -H drapeau et la configuration JSON ne sont pas fusionnées avec ça. Alors, comment pouvons-nous changer ces paramètres par fichier json ou modifier les paramètres de démarrage dockerd?

Répondre

1

Vous avez un cas similaire avec 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.

Ou ajouter dans docker.conf

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

Mais la position officielle reste:

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 a été rejeté, pour issue 21559.

+0

Voir aussi: https://github.com/docker/docker/pull/20410 – VonC

+0

Merci pour votre réponse. J'ai vu ce pr/question aussi bien. Cependant, je suis sur Windows. Comment puis-je changer les paramètres par défaut de dockerd afin que je puisse ajouter le -H au lieu de dans le fichier? –

+0

Je suis également à la recherche de ceci - assez ennuyeux que Docker pour Windows semble commencer le service avec le drapeau -H. On dirait que mettre ceci par défaut dans le daemon.json aurait fonctionné à la place? –