'Docker dind : Cannot connect to the Docker daemon

While running docker:dind I can't use docker login command and any other docker command.

My use case is that I got a Nexus Docker Registry and I'm trying to connect to this registry through GitLab CI.

docker run --rm -it docker:stable-dind docker login -u user -p password https://registry.mine.io

Give:

Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?). Using system default: https://index.docker.io/v1/
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?


Solution 1:[1]

I have found solution of same problem in this article https://www.santoshsrinivas.com/docker-on-ubuntu-16-04/

You need to run next commant on machine with your gitlab-ci worker

sudo groupadd docker
sudo gpasswd -a gitlab-runner docker
sudo service docker restart

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ryabchenko Alexander