运维 | 如何解决“Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the d”问题 | Docker
问题描述
在使用 Docker 进行开发时,有时候会遇到连接 Docker 守护进程失败的问题,错误信息通常为 “Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the Docker daemon running?”。这个错误通常发生在没有正确配置 Docker 或者权限不足的情况下
分析原因
此错误的一些原因包括
-
The Docker daemon is not running. Docker守护程序未运行。
-
Docker doesn’t shutdown cleanly. Docker无法完全关闭。
-
Lack of root privileges to start the docker service. 缺少启动docker服务的root权限。
解决方法
方式三
vim /etc/sysconfig/docker
[外链图片转存中…(img-SZFRxhJc-1696524911044)]
方式二(优先考虑)
- 查看
/var/run/docker.dock
文件是否变成目录,如果是