Cannot connect to the Docker daemon
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Above message appears when we try to get the info of the Docker or check the status of docker upon installation. I have used CENT OS as part of Docker installation. Below is the error message.
docker –version command gives output of the Docker that is installed on OS. Whereas, docker info command fails to provide information. docker version command gives info about client and not about server daemon process.
Resolution
1. Check if the user is part of sudoers group or assign sudo provileges to the user. User which we are trying to start the docker should be having sudo access. If you have installed docker using Non Root user, then follow the last message provided during the final step of installation process.
Below message comes up during Installation of Docker,
If you would like to use Docker as a non-root user, you should now consider
adding your user to the “docker” group with something like:
sudo usermod -aG docker your-user
Adding a user to the “docker” group will grant the ability to run containers which can be used to obtain root privileges on the docker host.
2. Run the Docker service manually. Use dockered & so that it runs as a service in the background or use service docker start command for starting the docker.
Check the status of docker after performing any one of the above actions,
systemctl status docker
ps -ef|grep docker
URLs below for reference,