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

I turned on centos7 today. Since I did not set the boot-up auto-start, when I started docker, I found that docker-related commands would report errors. Baidu has said that I have tried reinstalling docker, but I still can’t solve the problem. Post a set of questions:

1. For example, I check the version information

 

 

2. Restart the container

 

 

3. Systemctl status docker Checking the docker status also found an error:

 

 

The final solution to the problem is:
enter /etc/docker, create a new one without a daemon.json file:

cd /etc/docker

 

 

 

Edit the daemon.json file:
add this code:

{
“registry-mirrors”: [“https://registry.docker-cn.com”]
}

 

Then restart docker:

When systemctl restart docker.service

uses the docker command again, there is no problem.
I hope this method is useful for you.


Read More:

Leave a Reply

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