. Advertisement .
..3..
. Advertisement .
..4..
I encountered: ”Cannot connect to the docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?” in completing my work:
$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
Is the docker daemon running?
Here is my program:
$ systemctl status docker
docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: https://docs.docker.com
What’s causing this error and how to fix it? Does someone have any suggestions for me?
The cause:
After examining your program, I found that you are trying to access the Docker service, but it is not active. This is the reason why you get the error: ”Cannot connect to the docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?”
Solution:
The best solution for this error is starting Docker using service.
If you use the package manager to set up the Docker, a Docker service will be created. It gets easier to manage the Docker. Now let’s use the
systemctl
service command to start the Docker:You can check your program when using Docker by the following command:
You can see that the current program with Docker service is running and the error: ”Cannot connect to the docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?” does not exist.