What This Error Means
The Docker CLI can't connect to the Docker daemon (engine).
How to Fix It
- Check daemon connectivity:
docker version(server section should appear). - If Docker is not running, start/restart it (Docker Desktop, or
sudo systemctl start docker). - Check active context:
docker context lsanddocker context show. - If using a remote daemon, validate
DOCKER_HOSTand TLS settings.
Why It Happens
- The Docker daemon is not running.
- You are pointing at the wrong Docker context/host (DOCKER_HOST / context mismatch).
- You do not have permission to access the Docker socket.
How to Verify
- Run
docker infoand confirm it returns daemon details. - Retry the original Docker command.
Manual daemon access checks
- On Linux, check socket permissions:
ls -la /var/run/docker.sock. - Confirm your user groups include
docker(then re-login):groups.
Common CLI Output
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?Cannot connect to the Docker daemon. Is 'docker daemon' running on this host? How Docker CLI talks to the daemon
- The Docker CLI is a client that talks to the Docker daemon via a Unix socket or TCP.
- When the daemon is down, unreachable, or blocked by permissions, the CLI fails immediately.
Prevention Tips
- Keep Docker Desktop / Docker Engine updated on build machines.
- Avoid hardcoding
DOCKER_HOSTunless you truly need remote contexts. - Monitor daemon health on CI runners.
Where This Can Be Triggered
docs.docker.com/engine/install/linux-postinstall/
Official Docker documentation reference connected to this failure mode. - Source