If you get the following error when trying to run a Docker container:
Cannot connect to the Docker daemon at unix:/var/run/docker.sock. Is the docker daemon running?
Then you can resolve it by running the following:
systemctl start docker
If this doesn’t work because of a root
user issue, then you can do the following first:
gpasswd -a $USER docker
Additional issues?
Issue 1
If you have tried the above, and get this error:
Failed to start docker.service: Unit docker.service is masked.
Then you can solve it as follows:
systemctl unmask docker.service
systemctl unmask docker.socket
systemctl start docker.service
Issue 2
You can still can’t get around this, then try and use the docker daemon service itself:
sudo dockerd