-1

The issue I am having is: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.

I have had this issue before and was fixed by removing the docker group, adding again and adding myself to the group. Tried that this time, no luck.

For some reason WSL does not like it when you do a system restart and seems to stop docker from working properly. However, docker is not being helpful with their debugging...

I want to be able to restart and it work fine without having to spend hours finding a new solution that might work.

I have tried lots of solutions from adding user to group and signing out and in to tinkering with the docker socket itself, nothing is working and it is really frustrating. I think it has something to do with user groups since that was the issue last time and always has been, but the previous workaround didn't work...

I have a makefile which I used to run docker commands as it is more effecient, but even when I run docker ps I get this:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
Is the docker daemon running?

The result I want is for docker to tell me that the it is starting my containers, yet it's not.

penguintr
  • 325
  • 1
  • 2
  • 14
  • You can check the service status with `sudo service docker status` – Nogoseke Aug 27 '19 at 10:42
  • When I run this command it says "Docker is not running". So obviously I am going to manually start it using: ```sudo service docker start``` and then I check again using the command you gave and I get the same error: "Docker is not running". – penguintr Aug 27 '19 at 11:00
  • check docker logs and run `which docker` then run with pull path – Adiii Aug 27 '19 at 11:01
  • ran with full path, same issue: ```Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?``` – penguintr Aug 27 '19 at 12:52

3 Answers3

0

probably you should do restart the docker service by following command

sudo service docker restart

if even though it is not resolved then refer this link--> https://docs.docker.com/install/linux/linux-postinstall/#configure-where-the-docker-daemon-listens-for-connections

MathanKumar
  • 543
  • 1
  • 4
  • 17
0

I guess you already enabled docker service via sudo systemctl enable docker which will restart docker service on host restart.

Hope below references will help you fixing your issue as they look similar to yours.

Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?

https://forums.docker.com/t/cant-run-docker-in-ubuntu-14-04-cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock/31355

Surya
  • 46
  • 3
0

Solution that worked for me was to:

1)sudo groupadd docker (delete and re-add the group if it's already made)
2)sudo usermod -aG docker $(whoami)
3)sudo newgrp docker (as you cannot log-in/out again on WSL)

fixed!

penguintr
  • 325
  • 1
  • 2
  • 14