运维 | 如何解决“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
文件是否变成目录,如果是
发表评论