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

Question

When running docker version in WSL (Windows Subsystem for Linux), the last line of the terminal reports an error.

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

Indicates that docker did not start normally, basically just restart docker.

Solution

My WSL is installed on Ubuntu system. Use command three to successfully start docker. If you are not familiar with Linux, you can try the following commands in turn.

  1. Command one
systemctl start docker
  1. Command two
sudo dockerd

dockerd is the daemon service for the docker container, since it is not running in the background, we cannot take any action related to the service and needs to be restarted.

  1. Command Three
sudo service --status-all
sudo service docker start

Conclusion

The above is a little experience that Xiaobian summarizes in the process of using docker. For more docker learning, please pay attention to my updates.

Reference

Comments