Docker Community Forums

Share and learn in the Docker community.

Bring Your Own Swarm: "Got permission denied while trying to connect to the Docker daemon socket"

swarm
docker
dockercloud

(Skipsizemore) #1

I’ve set up a Docker Swarm with three managers and two workers. It seems to be running just fine; all nodes are showing as Ready/Active when I run docker node ls. But when I attempt to run the command to attach this swarm to Docker Cloud, I get:

docker run -ti --rm -v /var/run/docker.sock:/var/run/docker.sock dockercloud/registration
Get http://%2Fvar%2Frun%2Fdocker.sock/v1.24/swarm: dial unix /var/run/docker.sock: connect: permission denied
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
github.com/docker/dockercloud-federation/vendor/github.com/docker/docker/client.(*Client).doRequest
        /go/src/github.com/docker/dockercloud-federation/vendor/github.com/docker/docker/client/request.go:147
...

It did download the registration image the first time I ran it:

docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/dockercloud/registration latest 0579ceb875bb 2 weeks ago 22.71 MB

These are all CentOS 7 machines, and I’m running as root (via sudo -s):

[root@localhost sizemore]# uname -a
Linux localhost.localdomain 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

All the machines have their firewalls set up identically:

firewall-cmd --info-zone=public
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens192
  sources:
  services: dhcpv6-client ssh
  ports: 2377/tcp 7946/tcp 7946/udp 4789/udp 2376/tcp 2376/udp
  protocols:
  masquerade: no
  forward-ports:
  sourceports:
  icmp-blocks:
  rich rules:

They’re all running the same version of Docker:

docker version
Client:
 Version:         1.12.6
 API version:     1.24
 Package version: docker-1.12.6-28.git1398f24.el7.centos.x86_64
 Go version:      go1.7.4
 Git commit:      1398f24/1.12.6
 Built:           Fri May 26 17:28:18 2017
 OS/Arch:         linux/amd64

Server:
 Version:         1.12.6
 API version:     1.24
 Package version: docker-1.12.6-28.git1398f24.el7.centos.x86_64
 Go version:      go1.7.4
 Git commit:      1398f24/1.12.6
 Built:           Fri May 26 17:28:18 2017
 OS/Arch:         linux/amd64

I have no idea why the error is happening. In case it’s useful:

 ls -l /var/run/docker.sock
srw-rw----. 1 root root 0 Jun  1 15:54 /var/run/docker.sock

I get the same result running the command via sudo (without the -s). The only advice I have seen has been to add the user to the “docker” group, but there exists no docker group on the machine. There is a “dockerroot” group. I tried adding my regular user to that group and then running the join command via sudo, but got the same error.

So, I’m really totally stuck. Any help will be greatly appreciated.


(Guido) #2

Hi @skipsizemore. Any luck solving this issue? Thanks.