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.
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.
sudo systemctl start docker
# where systemd is unavailable:
sudo dockerd > /tmp/dockerd.log 2>&1 &
docker info # confirm the daemon respondsPoint DOCKER_HOST at the right daemon
- Unset a stale
DOCKER_HOSTto fall back to the local socket. - For a DinD service, set
DOCKER_HOST=tcp://docker:2375(or the configured host/port) and ensure the service is linked. - Confirm with
docker context lswhich 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.