How to fix - Cannot connect to the Docker daemon

14 July,2020 by Jack Vamvas

Question: I'm getting this error message when attempting to connect to the Docker daemon ? Can you supply a method to fix this issue



docker info Cannot connect to the Docker daemon at tcp://localhost:2375/usr/lib/systemd/system/docker.socket. Is the docker daemon running?

 

Answer: I've experienced this problem previously - and this is the way I worked around the problem.Let me know if this doesn't fix the issue 

 

  1. Add your self to the docker group

    usermod -aG docker $USER

  2. Fix permissions on docker socker and command.

    sudo chgrp docker /usr/bin/docker
    sudo chgrp docker /var/run/docker.sock

    $ ll $(which docker) -rwxr-xr-x 1 root docker 18991768 08.07.2017 22:57 /usr/bin/docker*

    $ ll /var/run/docker.sock srw-rw---- 1 root docker 0 23.07.2017 10:21 /var/run/docker.sock

  3. Add variables to config environment for docker command

    export DOCKER_HOST=unix:///var/run/docker.sock

  4. Rest Docker

    sudo systemctl restart docker


Author: Jack Vamvas (http://www.dba-ninja.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to fix - Cannot connect to the Docker daemon


dba-ninja.com