日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Ubuntu >内容正文

Ubuntu

ubuntu docker报错

發布時間:2024/1/17 Ubuntu 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ubuntu docker报错 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

以下問題及解決方法都在Ubuntu16.04下,其他環境類似

問題描述

安裝完docker后,執行docker相關命令,出現

”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“

原因

摘自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權限才能訪問。
解決方法1

使用sudo獲取管理員權限,運行docker命令
解決方法2

docker守護進程啟動的時候,會默認賦予名字為docker的用戶組讀寫Unix socket的權限,因此只要創建docker用戶組,并將當前用戶加入到docker用戶組中,那么當前用戶就有權限訪問Unix socket了,進而也就可以執行docker相關命令

sudo groupadd docker #添加docker用戶組 sudo gpasswd -a $USER docker #將登陸用戶加入到docker用戶組中 newgrp docker #更新用戶組 docker ps #測試docker命令是否可以使用sudo正常使用

轉載于:https://www.cnblogs.com/plusUltra/p/11206943.html

總結

以上是生活随笔為你收集整理的ubuntu docker报错的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。