
本文共 901 字,大约阅读时间需要 3 分钟。
-
问题描述
直接运行
docker
命令出现:Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://~images/json: dial unix /var/run/docker.sock: connect: permission denied
sudo docker
执行命令才可以. -
解决方案
If you want to run docker as non-root user then you need to add it to the docker group.
sudo groupadd dockersudo usermod -aG docker $USERnewgrp docker
On Linux, when you run any
docker
command, the docker binary will try to connect to/var/run/docker.sock
. As indicated by its.sock
extension, this file is a Unix Domain Socket - basically, a way so multiple processes can communicate on the local computer (also called an IPC mechanism.)IPC, Inter-Process Communication
In the case of Docker, the main reason for using the socket is that any user belonging to the
docker group
can connect to the socket while the Docker daemon itself can run asroot
. -
References
发表评论
最新留言
关于作者
