Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?
You can try out this:
systemctl start docker
It worked fine for me.
P.S.: after if there is commands that you can't do without sudo, try this:
gpasswd -a $USER docker
Just Run
sudo dockerd
dockerd is the daemon service for docker containers, because it is not running in background we're not able to take any actions related to the service, which needs be restarted.
You can get this error if docker doesn't shut down cleanly. The following answer is for the docker snap package.
Run snap logs docker
and look for the following:
Error starting daemon: pid file found, ensure docker is not running or delete /var/snap/docker/179/run/docker.pid
Deleting that file and restarting docker worked for me.
rm /var/snap/docker/<your-version-number>/run/docker.pidsnap stop dockersnap start docker
Make sure to replace <your-version-number>
with the appropriate version number.