Docker config remote API via daemon.json issue
使用daemon.json配置docker remote API时出现以下错误:
Aug 09 10:38:49 node02 dockerd[1169]: unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: hosts: (from flag: [fd://], from file: [
unix:///var/run/docker.sock tcp://0.0.0.0:2376])
解决方法:
Use the command
sudo systemctl edit docker.serviceto open an override file for docker.service in a text editor.Add or modify the following lines, substituting your own values.
[Service] ExecStart= ExecStart=/usr/bin/dockerdSave the file.
Reload the systemctl configuration.
$ sudo systemctl daemon-reloadRestart Docker.
$ sudo systemctl restart docker.serviceCheck to see whether the change was honored by reviewing the output of netstat to confirm dockerd is listening on the configured port.
$ sudo netstat -lntp | grep dockerd tcp 0 0 0.0.0.0:2376 0.0.0.0:* LISTEN 3758/dockerd