一、概述

普通用户执行命令:docker ps报错,具体信息如下:

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.38/containers/create: dial unix /var/run/docker.sock: connect: permission denied.

出现上面问题是因为:

Manage Docker as a non-root user
即:管理Docker的不是root用户

原文表述:

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权限才能访问。

二、解决方案

方案一:使用sudo获取管理员权限,运行docker命令
方案二:添加docker group组,将用户添加进去

环境说明

操作系统:centos 7.6

docker版本:19.03.5

由于采用的是jumpserver方式登录,开发人员使用的是develop账号。

docker安装之后,默认会创建组docker,因此不需要再创建了。

执行命令

使用root账号登录目标服务器

#将登陆用户develop加入到docker用户组中
gpasswd -a develop docker
#更新用户组
newgrp docker

切换到develop用户进行测试

su develop
docker ps

输出正常,则表示成功了。

本文参考链接:

https://www.jianshu.com/p/a0cf03605c42

Docker daemon socket权限不足的更多相关文章

  1. Got permission denied while trying to connect to the Docker daemon socket at

    添加新用户后执行docker命令由于没权限出现以下报错: ”Got permission denied while trying to connect to the Docker daemon soc ...

  2. Docker permission denied while trying to connect to the Docker daemon socket

    Problem jenkins执行docker打包的时候报错,说没有权限 docker build -t docker.ryan-miao.com/com.demo:f1aa23e --build-a ...

  3. Got permission denied while trying to connect to the Docker daemon socket at unix

    拉取Dockerimages时错误信息如下: [master@localhost ~]$ docker pull redis Using default tag: latest Got permiss ...

  4. 启动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 uni ...

  5. 解决Docker运行命令时提示"Got permission denied while trying to connect to the Docker daemon socket"类情况

    Docker安装命令: 解决Docker运行命令时提示"Got permission denied while trying to connect to the Docker daemon ...

  6. 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:/ ...

  7. 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 ...

  8. [问题解决]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 ...

  9. 【解决】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 ...

随机推荐

  1. 【洛谷 p3390】模板-矩阵快速幂(数论)

    题目:给定n*n的矩阵A,求A^k. 解法:利用矩阵乘法的定义和快速幂解答.注意用负数,但是数据太弱没有卡到我......(P.S.不要在 typedef long long  LL; 前使用 LL. ...

  2. P2762 太空飞行计划问题 (最小割)

    题意:n个实验 每个实验可获利ai元 做每个实验需要几个仪器 购买每个仪器有不同的花费 不同实验可能会用到同一个仪器 只用购买一次 求最大收益 题解:......................... ...

  3. hdu3577 Fast Arrangement

    Problem Description Chinese always have the railway tickets problem because of its' huge amount of p ...

  4. ZYB loves Xor I HDU - 5269 字典树

    题意: T组样例,给你n个数.你要找出来这n个数中任意两个数的二进制位中  最低位不同  的位置(假设是k),然后让所有2^k加起来就是结果 什么意思? 例如4 和 2 4的二进制是(100),2的二 ...

  5. 过滤器,拦截器,aop区别与使用场景

    1. 什么是过滤器 过滤器,顾名思义就是起到过滤筛选作用的一种事物,只不过相较于现实生活中的过滤器,这里的过滤器过滤的对象是客户端访问的web资源,也可以理解为一种预处理手段,对资源进行拦截后,将其中 ...

  6. Rsyncd 同步服务

    目录 数据备份的策略 三种数据备份 三种数据备份的比较(转载) 不同数据备份类型组合说明(转载) Rsyncd 服务传输模式(remote synchronizetion deamon) 本地传输模式 ...

  7. zzuli-2259 matrix

    题目描述 在麦克雷的面前有N个数,以及一个R*C的矩阵.现在他的任务是从N个数中取出 R*C 个,并填入这个矩阵中.矩阵每一行的法值为本行最大值与最小值的差,而整个矩阵的法值为每一行的法值的最大值.现 ...

  8. HDU 6623 Minimal Power of Prime(思维)题解

    题意: 已知任意大于\(1\)的整数\(a = p_1^{q_1}p_2^{q_2} \cdots p_k^{q_k}\),现给出\(a \in [2,1e18]\),求\(min\{q_i\},q ...

  9. sql-libs(2) 数字型

    经测试,发现是数字型的注入,直接 and 1=1 返回正常,and1=2返回错误,感觉比第一关更加简单一点啊,,透~ 经测试order by 为 3 . 1. union 注入 http://192. ...

  10. 1GB === 1000MB & 1GB === 1024MB

    1GB === 1000MB & 1GB === 1024MB 字节单位换算 1 Gigabyte = 1000 Megabytes 1 Gibibyte = 1024 Mebibytes 十 ...