What Docker Could Not Reach
The Docker CLI cannot reach the Docker daemon, usually because the engine is stopped, the context is wrong, or the socket is unavailable.
Read this as a precise clue about which part of the workflow broke first. Once you know the failing layer, the fix path gets much shorter.
Restore Docker daemon access
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 ls and docker context show
If using a remote daemon, validate DOCKER_HOST and TLS settings.
Check the daemon endpoint and socket
On Linux, check socket permissions with ls -la /var/run/docker.sock, and confirm your user groups include docker (then re-login): groups.
Why It Happens
Usually this comes down to the Docker daemon is not running, you are pointing at the wrong Docker context/host (DOCKER_HOST / context mismatch), or you do not have permission to access the Docker socket.
Prove the Failing Environment Can Reach It
Run docker info and confirm it returns daemon details, and retry the original Docker command.
How Docker reaches 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.
Examples
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? Prevent It From Coming Back
To prevent this, keep Docker Desktop / Docker Engine updated on build machines, avoid hardcoding DOCKER_HOST unless you truly need remote contexts, and monitor daemon health on CI runners.