Saturday 3 October 2020

Docker Tinkering: Troubleshoot Is the docker daemon running? Problem

 Got this error:

$ sudo docker build -t name:version .

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

ERRO[0000] failed to dial gRPC: cannot connect to the Docker daemon. Is 'docker daemon' running on this host?: dial unix /var/run/docker.sock: connect: connection refused 

Also problem can be seen down below:

$ sudo service docker status

● docker.service

   Loaded: masked (/dev/null; bad)

   Active: inactive (dead) since Fri 2020-10-02 13:34:41 EDT; 1 day 7h ago

 Main PID: 32072 (code=exited, status=0/SUCCESS)


Solution:

$ sudo systemctl unmask docker

Removed /etc/systemd/system/docker.service.

$ sudo systemctl start docker

$ sudo service docker status

● docker.service - Docker Application Container Engine

   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: e

   Active: active (running) since Sat 2020-10-03 21:28:48 EDT; 3s ago

     Docs: https://docs.docker.com

 Main PID: 11763 (dockerd)

    Tasks: 16

   CGroup: /system.slice/docker.service

           └─11763 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/contai


ref:

https://stackoverflow.com/questions/44678725/cannot-connect-to-the-docker-daemon-at-unix-var-run-docker-sock-is-the-docker