ErrorDocker
Cannot connect to the Docker daemon
Why the Docker CLI reports it can't connect to the daemon, how to tell 'not running' apart from a permissions problem, and how to fix each.
Last updated
ErrorDocker
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
What it means: The `docker` CLI can't reach the Docker daemon — the background service that actually runs containers — through its socket; the CLI itself works fine, but nothing is listening on the other end.
Likely causes
Most probable first — with how to confirm.
- 1.Docker Desktop (macOS/Windows) or the `dockerd` service (Linux) simply isn't running — check for the Docker Desktop app, or on Linux, `systemctl status docker`.
- 2.On Linux, your user isn't in the `docker` group, so you lack permission to talk to the socket even though the daemon is running — this usually surfaces as a 'permission denied' variant of this same message rather than 'is it running'; check `groups $USER` and `ls -l /var/run/docker.sock`.
- 3.The daemon crashed or is still starting up, common right after a reboot or a Docker Desktop update — give it a few seconds and retry.
- 4.You're targeting a non-default Docker context (the `DOCKER_HOST` env var, or `docker context`) that points at a daemon that isn't actually reachable from here.
Fixes
Safest first; destructive ones are called out.
- →Start Docker: open Docker Desktop and wait for it to report 'running' (macOS/Windows), or run `sudo systemctl start docker` (Linux) — then retry the command.
- →On Linux, if it's a permissions issue rather than 'not running', add your user to the docker group (`sudo usermod -aG docker $USER`) and log out and back in (or run `newgrp docker`) rather than routinely prefixing commands with `sudo`.
- →Check `docker context ls` and `echo $DOCKER_HOST` if you suspect it's pointed at the wrong daemon, and switch back with `docker context use default` if so.
- →If Docker Desktop itself won't start, restarting the app (or the host machine) resolves most transient daemon crashes; a persistent failure is worth checking Docker Desktop's own diagnostic logs for.