Docker "Cannot connect to the Docker daemon" (dind) in CI
The client could not reach a daemon at all. In CI this usually means Docker-in-Docker has not finished starting, the dind service is missing, or DOCKER_HOST points nowhere.
What this error means
Any docker command fails with Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. It often clears once the dind service is fully up.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?Common causes
dind service not started yet
The Docker-in-Docker sidecar is still booting when the first docker command runs, so the socket is not ready.
No daemon / wrong DOCKER_HOST
No dind service is configured, or DOCKER_HOST points at an address with no daemon listening.
Missing privileged mode
dind needs privileged mode (or the right setup) to run; without it the daemon never starts.
How to fix it
Wait for and target the daemon
- Point DOCKER_HOST at the dind service and wait until it responds.
export DOCKER_HOST=tcp://docker:2375
until docker info >/dev/null 2>&1; do sleep 1; doneConfigure the dind service correctly
- Add a privileged docker:dind service or enable the dind option in your CI.
- Ensure TLS/host settings match between client and dind.
How to prevent it
- Add a readiness wait for the dind daemon before the first docker command. Latchkey managed runners provide a ready Docker daemon and auto-retry transient daemon-not-ready startup races, so jobs do not fail on a boot timing blip.