问题
我在进行docker pull bestwu/qq操作的时候报了错误:
Got permission denied while trying to connect to the Docker daemon
socket at unix:///var/run/docker.sock: Post
“http://%2Fvar%2Frun%2Fdocker.sock/v1.40/images/create?fromImage=bestwu%2Fqq&tag=latest”:
dial unix /var/run/docker.sock: connect: permission denied
原因分析
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权限 才能访问。
解决方案
sudo groupadd docker
sudo gpasswd -a $XXX docker
sudo gpasswd -a $USER docker
newgrp docker
再次执行"docker pull bestwu/qq"命令,发现不再出现"Got permission denied"权限报错
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)