Cannot connect to the Docker daemon
If you are just getting started with Docker there are a few different common error messages that will come up from time to time. One of these error messages is “Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?” . This specific message usually just means that the Docker daemon isn’t running. It could theoretically be caused by other things but more than likely it is just a case of the service needing to be started up. If it were a permissions issue you would see a different error.
This usually comes up when trying to run any Docker command such as this:
The fix for: “Cannot connect to the Docker daemon”
You can check if the Docker daemon is running like this:
ps -ef |grep -i docker
If it isn’t you can start it like this:
sudo systemctl start docker
Sometimes people run into issues that require a bit more troubleshooting. One such instance can be seen HERE
Depending on your setup, there may be edge cases in which you receive this error message for other reasons. For example, let’s say you have centralized set of Docker servers but you choose to run the Docker client on your workstation. In this case you might be blocked by a firewall or you might be experiencing a network issue.
This could occur if you are running a command like this:
docker -H=remote-server1:2376 ps