> vim /etc/docker/daemon.js { "hosts": [ "tcp://0.0.0.0:2375", "unix:///var/run/docker.sock" ] }
注意上面👆一定要写上本地的 socket 位置, 不然无法使用本地的 CLI 控制 docker
unix:///var/run/docker.sock
修改完js配置文件后, 重启 docker 服务, 出现了如下报错
1 2
> systemctl restart docker.service Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe"for details.
Feb 06 12:16:57 xsl systemd[1]: Starting Docker Application Container Engine... Feb 06 12:16:57 xsl dockerd[21952]: 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: [tcp://0.0.0.0:2375, unix:///var/run/docker.socket]) Feb 06 12:16:57 xsl systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE Feb 06 12:16:57 xsl systemd[1]: Failed to start Docker Application Container Engine. Feb 06 12:16:57 xsl systemd[1]: docker.service: Unit entered failed state. Feb 06 12:16:57 xsl systemd[1]: docker.service: Failed with result 'exit-code'.