Docker CLI 返回:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
$USER
已添加到docker组。
$systemctl status docker
返回:
● docker.service - Docker Application Container Engine
Loaded: loaded (/etc/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: start-limit-hit) since wo 2019-05-08 12:44:07 CEST; 36min ago
Docs: https://docs.docker.com
Main PID: 10460 (code=exited, status=1/FAILURE)
$journal -u docker
回到:
Caused by Error starting daemon: Error initializing network controller
答案1
看完之后/var/log/syslog
我明白了Error starting daemon: Error initializing network controller: invalid CIDR address:
。
问题出在单元文件中,/etc/systemd/system/docker.service
更确切地说是--bip使用的标志ExecStart=/usr/bin/dockerd
(它告诉守护进程更改默认 docker-bridge 的默认范围)并不好。
PS:用于恢复docker.socket单元文件(版本18.09)的有用链接:
https://github.com/docker/docker-ce/blob/v18.09.0/components/packaging/systemd/docker.service