解决Ubuntu18.04启动Docker Got permission denied while trying to connect to the Docker daemon socket问题

1.su切换root用户就可以了。如果出现Autentication failure,那么看看下面这文章。

https://wenda.so.com/q/1372955688063848

怎么吧linux切换成超级用户呢

bcnyjt12级分类:编程开发被浏览2512次2013.07.04

 

其实我的情况是这样的 我的系统设置了密码123456 当我su root的时候 终端提示输入密码 但是我输的时候还没有等我输完密码 终端自动提示 12su Autentication failure 这是为啥呢??

满意答案

luhengqf

采纳率:40%12级 2013.07.04

su -
这样,就在当前目录下,变更成超级用户
如果之前没有设置过超级用户密码的话
需要使用sudo passwd root
按照提示,如果是提示输入密码,就是你的用户密码
然后提示输入 Unix密码
确认Unix密码
然后再使用我提供 su - 然后提示输入root密码,再然后就进入你要的root权限

 

或者:https://blog.csdn.net/jxaucm/article/details/80194372

 

 

2.还有另外一个方法,添加用户组,下面文章非常详细清晰,有没有用我还没有试,现在用root解决:

http://www.javashuo.com/article/p-ninpxcmn-gg.html

解决Ubuntu18.04启动Docker"Got permission denied while trying to connect to the Docker daemon socket"问题

解决Ubuntu18.04启动Docker"Got permission denied while trying to connect to the Docker daemon socket"问题

LL Leung 2019-06-15 12:33:58   8245   收藏 15
展开
目录

1 问题描述

2 原因分析

3 解决方法

4 检查是否更新成功

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 $USER docker #将当前用户添加至docker用户组
newgrp docker #更新docker用户组


4 检查是否更新成功
再次执行"docker version"命令,发现不再出现"Got permission denied"权限报错


点赞
22

评论
2

分享

收藏
15

手机看

打赏
文章举报
收起全文

66个Python新手项目,学完立马上手做项目
阅读数2661

一个 Python 程序员的成长路线图应该是这样子的
学院
来自:CSDN

 

 
weixin_43391622:nice!!1个月前

Eric.py:不错1个月前 ———————————————— 版权声明:本文为CSDN博主「LL Leung」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/liangllhahaha/article/details/92077065