Overview
You see this when the Docker CLI cannot reach the Docker daemon (dockerd). Typical message:
- error during connect: this may indicate the docker daemon is not running
The fix is to start the daemon (or Docker Desktop), ensure the socket/pipe is reachable, and correct context/environment misconfiguration.
Table: default daemon endpoints
| Platform | Endpoint |
|---|---|
| Linux (rootful) | unix:///var/run/docker.sock |
| Linux (rootless) | unix:///run/user/<uid>/docker.sock |
| macOS (Desktop) | docker-desktop VM via com.docker.backend |
| Windows (Desktop, WSL2) | //./pipe/docker_engine via com.docker.service |
Quickstart (most cases)
- Linux (systemd):
- sudo systemctl start docker
- docker info
- sudo systemctl enable docker
- macOS (Docker Desktop):
- Open Docker Desktop
- Wait for “Docker is running”
- docker info
- Windows (Docker Desktop + WSL2):
- Start Docker Desktop
- powershell: Restart-Service com.docker.service
- docker info
If it still fails, follow the platform steps below.
Minimal working example
Once the daemon is running, validate with a small container.
Linux/macOS:
# Should print an Engine version and no errors
docker version
# Run a tiny container
docker run --rm busybox:latest echo ok
Windows (PowerShell):
# Engine info
docker version
# Tiny container
docker run --rm mcr.microsoft.com/powershell:nanoserver-ltsc2022 pwsh -c '"ok"'
Expected output includes “Server: Docker Engine” from docker version and prints ok from the test container.
Linux: step-by-step
- Check service status
sudo systemctl status docker --no-pager
- If inactive: start it
sudo systemctl start docker
sudo systemctl enable docker
- Inspect logs if it fails to start
sudo journalctl -u docker -b --no-pager
Common log causes:
- Missing cgroups or incompatible cgroup driver.
- Low disk space on /var or / (overlay2 needs free inodes and space).
- Stale lock or socket.
- Verify the socket
# Should exist and be a socket
ls -l /var/run/docker.sock
sudo ss -xl | grep docker.sock || echo "socket not listening"
If socket exists but dockerd is not running, remove stale socket and restart:
if [ -S /var/run/docker.sock ] && ! pgrep -x dockerd >/dev/null; then
sudo rm /var/run/docker.sock
fi
sudo systemctl restart docker
- Non-systemd systems
# SysV/Upstart fallback
sudo service docker start
- Permission note If you see “permission denied” instead of “daemon not running”, add your user to the docker group and re-login:
sudo usermod -aG docker "$USER"
newgrp docker
macOS (Docker Desktop)
- Start Docker Desktop (Applications → Docker or run):
open -a Docker
- Wait for the whale icon to indicate running, then test:
docker info
- If it hangs or errors:
- Restart backend
pkill -f com.docker.backend || true
open -a Docker
- Ensure your user has permissions to run Docker Desktop and enough resources (see Performance notes).
Windows (Docker Desktop with WSL2)
- Ensure Docker Desktop is running. Then:
# Restart Desktop backend
Restart-Service com.docker.service -ErrorAction SilentlyContinue
wsl.exe --list --verbose
- Restart WSL integration if needed:
wsl.exe --shutdown
Start-Process "C:\Program Files\Docker\Docker\Docker Desktop.exe"
- Verify the named pipe
Get-ChildItem -Path "\\.\pipe\" | Where-Object { $_.Name -like "docker_engine*" }
If missing, Desktop backend is not up.
- Windows Server (Docker Engine without Desktop):
Start-Service docker
Get-Service docker
Rootless Docker (Linux)
If you installed rootless mode:
# Start per-user service
systemctl --user start docker
systemctl --user enable docker
# Ensure the client talks to the rootless socket
export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock
Check:
docker context ls
printenv DOCKER_HOST
Contexts and DOCKER_HOST
A wrong context or stale DOCKER_HOST often causes this error.
- Show contexts:
docker context ls
- Switch to default:
docker context use default
- Clear accidental override:
unset DOCKER_HOST
- For remote engines, ensure the target is reachable (SSH/TCP) and the daemon running on the remote host.
Network, proxy, and firewall
- Corporate proxies or firewalls can block dockerd image pulls; that’s a different error. But if dockerd fails to start due to proxy env in systemd, verify:
systemctl show docker | grep -i Environment
- Adjust or remove HTTP(S)_PROXY in the service drop-in if it prevents startup, then restart.
Diagnostics and logs
- Engine logs (Linux):
sudo journalctl -u docker -b
- Desktop diagnostics (macOS/Windows): Use the “Troubleshoot” option in Docker Desktop, then restart.
- Confirm disk and memory are sufficient:
df -h /
free -h || vm_stat 2>/dev/null
Pitfalls to avoid
- Confusing “daemon not running” with “permission denied.” The former is connectivity; the latter is group/ACLs.
- Leaving DOCKER_HOST set to a dead socket/host.
- Running both rootful and rootless with the same client variables.
- Stale /var/run/docker.sock after a crash; remove it only if dockerd is not running.
- WSL2 distro not set to version 2 or Integration disabled with your distro in Docker Desktop settings.
Performance notes
- Enable auto-start so the daemon is ready after boot:
- Linux: sudo systemctl enable docker
- macOS/Windows Desktop: enable “Start Docker Desktop when you log in.”
- Resource sizing (Desktop): allocate enough CPUs/RAM for quick startup; too little RAM can delay or prevent the backend from starting.
- Keep /var/lib/docker on a disk with ample space and inodes; low space can block daemon startup.
- Avoid unnecessary debug logging on production hosts; it can slow startup and fill disks.
- On Linux, prefer overlay2 with an up-to-date kernel for stability.
FAQ
Why does docker version show only Client info? The daemon is unreachable. Start or fix the daemon as above, then rerun.
Do I need sudo for docker? Only if your user isn’t in the docker group (rootful). Rootless mode avoids sudo but requires DOCKER_HOST to point to the user socket.
How do I fix this in CI? Ensure the runner starts dockerd (e.g., systemctl start docker) or use docker-in-docker images that launch dockerd in the job.
Is Docker Desktop required on Linux? No. Use the Docker Engine package from your distro, manage with systemd.
Can an outdated kernel cause this? Yes. Very old kernels or incompatible cgroup setups can prevent dockerd from starting; update kernel and ensure cgroup v2 is supported or configure cgroup driver accordingly.