解决docker permission denied docker.sock 错误

在gitlab-ci时报了Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:错误:
1.解决办法先把当前用户加入docker组:

$ sudo gpasswd -a ${USER} docker
Adding user ddd to group docker

注:${USER} 当前用户
2.查看是否在组里:

$ sudo cat /etc/group |grep ^docker
docker:x:999:aaa,bbb,ccc,ddd

3.更新用户组

$ sudo newgrp docker

4.更新权限,不执行不生效:

$ sudo chmod 666 /var/run/docker.sock
$  sudo chown root:docker /var/run/docker.sock

你可能感兴趣的:(解决docker permission denied docker.sock 错误)