How to fix docker 'Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?' on Ubuntu

Problem:

You’re running a docker command like docker ps, but you only see this error message:

docker_connect_error.txt
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Solution

As the error message already tells you, the docker daemon is currently not running.

On Ubuntu (16.04 upwards) and many other systemd-based distributions, you can fix this by

start_docker.sh
sudo systemctl start docker

In most cases, you want to automatically start the docker daemon at boot. In order to do this, run

enable_docker.sh
sudo systemctl enable docker

After that, run your command (e.g. docker ps) again.


Check out similar posts by category: Container, Docker, Linux