Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
时间: 2023-10-17 13:36:24 浏览: 210
Docker”Got permission denied while trying to connect to the Docker daemon socket”报错解决
5星 · 资源好评率100%
这个错误提示意味着在尝试连接到Docker引擎的Unix socket时,权限不足。默认情况下,只有root用户和docker组的用户才能访问Docker引擎的Unix socket。在Linux系统上,出于安全考虑,一般不会直接使用root用户。因此,解决这个问题的方法是将当前用户添加到docker组中。
具体步骤如下:
1. 打开终端,并输入以下命令:sudo gpasswd -a username docker(将普通用户username加入到docker组中,其中username可以直接替换为你的用户名)。
2. 输入命令newgrp docker,以更新docker组。
3. 然后再次尝试运行之前报错的命令,此时应该就不会再报错了。
通过以上步骤,你将能够将当前用户添加到docker组,从而解决连接Docker引擎时权限不足的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [docker执行权限问题Got permission denied while trying to connect to the Docker daemon socket](https://blog.csdn.net/m0_59092234/article/details/126327563)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Docker”Got permission denied while trying to connect to the Docker daemon socket”报错解决](https://download.csdn.net/download/weixin_38714370/14042035)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [Got permission denied while trying to connect to the Docker daemon socket at unix:/](https://blog.csdn.net/BaoITcore/article/details/127736052)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文