当前位置: 代码网 > 科技>操作系统>Unix > Cannot Connect to the Docker Daemon at ‘unix:///var/run/docker.sock’ 出坑方法,已经解决了

Cannot Connect to the Docker Daemon at ‘unix:///var/run/docker.sock’ 出坑方法,已经解决了

2024年07月31日 Unix 我要评论
docker安装后,使用中经常出现的错误是:Cannot connect to the Docker daemon at (unix:///var/run/docker.sock. Is the docker daemon running?)

docker安装后,使用中经常出现的错误是:

cannot connect to the docker daemon at (unix:///var/run/docker.sock. is the docker daemon running?) 

cannot connect to the docker daemon at (unix:///var/run/docker.sock. is the docker daemon running?) 

一、什么原因导致的:

触发此错误的一些原因包括:

  • the docker daemon is not running.   docker守护程序未运行。
  • docker doesn’t shutdown cleanly.       docker无法完全关闭。
  • lack of root privileges to start the docker service.   缺少启动docker服务的root权限。

              我尝试了第3种方法(启动dockerd)解决了这个问题,所以 分享给大家!

二、各种可能的解决方案。

解决方法1:使用systemctl命令   (start the docker service with systemctl)

如果您刚刚在ubuntu上完成了docker的新安装或重新启动了pc,那么很有可能docker服务没有运行( there is a high probability chance the docker service is not running. )。docker守护程序(dockerd)是docker的系统服务。该服务处理各种docker对象,如图像、容器、网络和卷,并侦听docker api请求。

systemctl命令用来取代旧的sysv init系统,它管理在linux系统上运行的systemd服务。

注意:此方法仅适用于使用apt包管理器安装docker的用户。如果您通过snap安装了docker,请参阅下面的解决方法5。

(1)在终端中执行 – unmask docker.

sudo systemctl unmask docker

如果docker被masked了,一般会有这样的提示:‘failed to start docker.service: unit is masked.’ 

(2)启动 start the docker daemon


                

                    
(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com