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:

1
systemctl start docker

If this doesn’t work because of a root user issue, then you can do the following first:

1
gpasswd -a $USER docker

Additional issues?

Issue 1

If you have tried the above, and get this error:

1
Failed to start docker.service: Unit docker.service is masked.

Then you can solve it as follows:

1
2
3
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:

1
sudo dockerd