启动docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
启动docker提示:
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create?name=hjenkins: dial unix /var/run/docker.sock: connect: permission denied.

权限问题:
1.查看所有用户组与用户
vim /etc/group
/etc/group 的内容包括用户组(Group)、用户组口令、GID及该用户组所包含的用户(User),每个用户组一条记录;格式如下:
group_name:passwd:GID:user_list
在/etc/group 中的每条记录分四个字段:
第一字段:用户组名称;
第二字段:用户组密码;
第三字段:GID
第四字段:用户列表,每个用户之间用,号分割;本字段可以为空;如果字段为空表示用户组为GID的用户名;
2.把jenkins用户加入到dockerroot用户组
gpasswd -a jenkins dockerroot #将登陆用户加入到docker用户组中
newgrp dockerroot #更新用户组
3.重启jenkins
hello world!
普通用户使用docker的方法
添加用户组,将用户添加到组,重启docker即可
[root@localhost ~]# groupadd docker
[root@localhost ~]# groups
root
[root@localhost ~]# usermod -a -G docker wade
[root@localhost ~]# grep docker /etc/group
dockerroot:x:994:
docker:x:1001:wade
[root@localhost ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@localhost ~]# sudo wade
[wade @localhost ~]$ docker image ls
————————————————
版权声明:本文为CSDN博主「wade3015」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wade3015/java/article/details/94588423
以下方法亲测可行:
1 问题描述
在终端执行"docker version"命令,出现如下报错:
”Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/images/json: dial unix /var/run/docker.sock: connect: permission denied“
2 原因分析
来自docker mannual:
Manage Docker as a non-root user
The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo. The docker daemon always runs as the root user.
If you don’t want to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.
docker进程使用Unix Socket而不是TCP端口。而默认情况下,Unix socket属于root用户,因此需要root权限才能访问。
3 解决方法
sudo groupadd docker #添加docker用户组
sudo gpasswd -a $XXX docker #检测当前用户是否已经在docker用户组中,其中XXX为用户名,例如我的,liangll。sudo gpasswd -a $uni docker
sudo gpasswd -a $USER docker #将当前用户添加至docker用户组
newgrp docker #更新docker用户组
4 检查是否更新成功
再次执行"docker version"命令,发现不再出现"Got permission denied"权限报错

————————————————
版权声明:本文为CSDN博主「LL_Leung」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/liangllhahaha/java/article/details/92077065
启动docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock的更多相关文章
- docker Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post
利用docker构建时,报错 + docker pull maven:3-alpine Got permission denied while trying to connect to the Doc ...
- Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.38/images/json: dial unix /var/run/docker.sock: conne
使用docker报如下错误信息: Got permission denied while trying to connect to the Docker daemon socket at unix:/ ...
- [问题解决]Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
写了一个脚本读取docker日志,发生报错:Got permission denied while trying to connect to the Docker daemon socket at u ...
- Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/images/j..........
如果你在执行 docker images 出现这样的问题 注意:把你的用户切到root下
- docker dial unix /var/run/docker.sock: connect: permission denied
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker. ...
- 【转载】Docker 安装后 报 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? 解决办法
Docker Docker 安装后 报 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docke ...
- 输入docker ps 报错信息处理Get http:///var/run/docker.sock/v1.19/containers/json: dial unix /var/run/docker.sock: permission denied.
完整错误信息 Get http:///var/run/docker.sock/v1.19/containers/json: dial unix /var/run/docker.sock: permis ...
- 【解决】Got permission denied while trying to connect to the Docker daemon socket at......dial unix /var/run/docker.sock: permission denied
>>> 问题:搭建Portainer时,选择本地连接报错? >>>分析: 根据报错信息可知是权限问题. 可能原因一:使用了非root用户启用或连接docker &g ...
- Docker未启动错误:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
此问题是因为Docker安装后未启动所致,执行以下命令启动docker: systemctl start docker.service 具体日志如下: Connecting to ... Connec ...
随机推荐
- 对象池在 .NET (Core)中的应用[2]: 设计篇
<编程篇>已经涉及到了对象池模型的大部分核心接口和类型.对象池模型其实是很简单的,不过其中有一些为了提升性能而刻意为之的实现细节倒是值得我们关注.总的来说,对象池模型由三个核心对象构成,它 ...
- VS+Qt+Halcon——显示图片,实现鼠标缩放、移动图片
摘要 本篇博文记录一下,用VS+Qt+Halcon实现对图片的读取以及鼠标缩放,移动(鼠标事件调用了halcon自带的算子)的过程.以及遇到的坑..... 先来看一下动态效果图: 主要控件: 添加一个 ...
- 题解 [美团 CodeM 初赛 Round B]景区路线规划
有个影响因素k,显然不能高斯消元 n和k都不大,可以直接\(O(nk)\)跑DP 然而带上时间这一影响因素后的转移颇为难写,我从6点直接调到9点最后还是只能dfs爆搜骗了55pts 考场上推方程一定要 ...
- nacos项目搭建(服务提供者,服务消费者)
spring cloud ablibaba 版本说明 https://github.com/alibaba/spring-cloud-alibaba/wiki/版本说明 启动nacos服务 官网: h ...
- 浅谈模拟彩票代码,html,javascript
今天简单介绍一下用html,javascript来模拟双色球彩票选择器. 双色球彩票规则:由6个红球和1个蓝球组成,其中6个红球是从1-33中随机选出的不重复的6个数,从小到大一次排列:蓝球是1-16 ...
- 并发容器之ConcurrentHashMap
JDK5中添加了新的concurrent包,相对同步容器而言,并发容器通过一些机制改进了并发性能.因为同步容器将所有对容器状态的访问都 串行化了,这样保证了线程的安全性,所以这种方法的代价就是严重降低 ...
- 何时覆盖hashCode()和equals()方法
The theory (for the language lawyers and the mathematically inclined): equals() (javadoc) must defin ...
- 在ubuntu18.04上部署项目时遇到的问题总结
因为在实验室中,有几台空闲的机子,我便选了一台准备做一个本地的服务器,因为买的阿里云学生机和之前用于FQ的机子感觉都不太顺手,阿里的学生机配置稍低,FQ用的服务器延迟太高.开始在centos和ubun ...
- Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
1.今天在进行hive测试的时候,发现hive一直进不去,并且报了这个错误. Unable to instantiate org.apache.hadoop.hive.ql.metadata.Sess ...
- 设置rem基准值
<script type="text/javascript"> (function(){ var docEl = document.documentElement; f ...