Skip to content
Latchkey

Docker "Cannot connect to the Docker daemon ... Is the docker daemon running?"

The Docker CLI reached the socket but got no daemon on the other end. Unlike a permission error, the socket connection itself fails - the engine is not running, or DOCKER_HOST points at the wrong place.

What this error means

Any docker command fails instantly with Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. No work happens because there is no daemon to talk to.

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

Common causes

The Docker daemon is not started

On container-based or minimal runners the engine is not running by default, so there is no daemon behind the socket.

DOCKER_HOST points at the wrong endpoint

A stale DOCKER_HOST (a remote daemon, a removed TCP endpoint, or an unset DinD service) makes the CLI connect to nothing.

Docker-in-Docker service not linked

In CI that relies on a dind service, a missing link or wrong host/port means the CLI cannot reach the side-car daemon.

How to fix it

Start the daemon (or use a runner that has it running)

Bring the engine up before any docker command.

Terminal
sudo systemctl start docker
# where systemd is unavailable:
sudo dockerd > /tmp/dockerd.log 2>&1 &
docker info   # confirm the daemon responds

Point DOCKER_HOST at the right daemon

  1. Unset a stale DOCKER_HOST to fall back to the local socket.
  2. For a DinD service, set DOCKER_HOST=tcp://docker:2375 (or the configured host/port) and ensure the service is linked.
  3. Confirm with docker context ls which endpoint the CLI uses.

How to prevent it

  • Use a runner image where Docker is preinstalled and running.
  • Start the daemon as an early step on container-based runners.
  • Keep DOCKER_HOST/context aligned with the actual daemon endpoint.

Frequently asked questions

What causes ""Is the docker daemon running?""?
On container-based or minimal runners the engine is not running by default, so there is no daemon behind the socket.
How do I fix "Is the docker daemon running?"?
Bring the engine up before any docker command.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card