欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 教育 > 高考 > (普通用户)Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

(普通用户)Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

2025/9/17 6:46:24 来源:https://blog.csdn.net/qq_70531838/article/details/141328551  浏览:    关键词:(普通用户)Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
报错: 
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?#大概像以下的报错内容
MernyPierreMBP:~ merny24$ docker info
Client:Version:    26.1.4Context:    defaultDebug Mode: falseServer:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
MernyPierreMBP:~ merny24$

环境:

在做某项配置时发现docker不能使用,检查了daemon.json文件是没有问题的。因为是另一个运维做的环境,就只有普通用户,docker的权限给不到

方法一

sudo groupadd docker               #添加用户组
sudo gpasswd -a username docker    #将当前用户添加至用户组
newgrp docker                      #更新用户组
#没效果再重启下试试

方法二
vim /lib/systemd/system/docker.service                  # Ubuntu的路径;
/usr/lib/systemd/system/docker.service                  # CentOS 的路径为;
修改文件内容:
# ExecStart=/usr/bin/dockerd -H fd://
ExecStart=/usr/bin/dockerd重新启动docker服务就行
service dockerd  restar

方法三

#这个方法不确定,因为我的环境里没有root,就是普通用户,但给了权限状态就恢复了

chmod 777 /run/docker.sock

systemctl restart docker

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词