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

This error message indicates that the Docker client is unable to connect to the Docker daemon, which is the background service that manages containers on your host machine. There are a few potential causes of this issue:

  1. The Docker daemon may not be running on your host machine. You can check if it's running by using the command "systemctl status docker" or "service docker status" based on your host system. If it's not running, you can start it using the command "systemctl start docker" or "service docker start".
  2. Another possibility is that the Docker daemon is running, but it's not listening on the correct socket. By default, the Docker daemon listens on a unix socket located at /var/run/docker.sock, but this location can be changed. You can check the location of the socket by looking at the "ExecStart" line in the file "/lib/systemd/system/docker.service" on Linux systems.
  3. The permission for the Unix socket /var/run/docker.sock. The error message is common when you running docker command with non-root user. Ensure that your user is part of the docker group or check that the unix socket has the correct permissions.
  4. In case of windows or Mac, there might be some issue with the Docker Toolbox installation.