Cannot connect to the Docker daemon at unix docker.sock. Is the docker daemon running?

In this article, we will see the solution for the Docker error:

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

Cannot connect to the Docker daemon at unix docker.sock. Is the docker daemon running?

Cannot connect to the Docker daemon at unix docker.sock. Is the docker daemon running?

This is because in addition to the docker.service unit file, there is a docker.socket unit file… this is for socket activation. The warning means if you try to connect to the docker socket while the docker service is not running, then systemd will automatically start docker for us.

Solution is simply start and stop the socket if the docker is triggered by the socket by running below command:

sudo systemctl stop docker.socket

Then, start the Docker using below command and perform actions on Docker Engine.

sudo systemctl start docker

Leave a Reply

Your email address will not be published. Required fields are marked *