解決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