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

The Docker CLI cannot reach the Docker daemon, usually because the engine is stopped, the context is wrong, or the socket is unavailable.

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?

Fix it fast

Most likely: Docker itself is not reachable from this shell: the daemon is stopped, Docker Desktop is still starting, or the CLI is pointed at the wrong context or DOCKER_HOST.

Confirm this is your error

Match the output and confirm you are troubleshooting the same failure.

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?

What Docker Could Not Reach

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.

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.

Need help or found a mistake? Contact RepoFlow support for questions.

Join our mailing list

Product updates, new tools, and practical guides from RepoFlow.