docker: Cannot connect to Docker daemon
This error matches known, documented patterns with reliable solutions.
Quick Fix (Most Common Solution)
- Start Docker service or Docker Desktop
- Add user to docker group
Seeing "docker: Cannot connect to Docker daemon"? This error can be frustrating, but it's usually fixable. It typically affects your development workflow or system. Below you'll find clear, step-by-step solutions to resolve this issue.
What This Error Means
The Docker background service is not running or accessible.
Frequently documented in developer and vendor support forums.
Not affiliated with browser, OS, or device manufacturers.
New here? Learn why exact error messages matter →
Common Causes
- Docker service not started
- User not in docker group
- Docker Desktop not running
How to Fix
- Start Docker service or Docker Desktop
- Add user to docker group
- Check Docker socket permissions
Last reviewed: April 2026 How we review solutions
Version note: On Linux, Docker Engine 24+ requires cgroup v2 by default. Older kernels (RHEL 7, CentOS 7) may need cgroup v1 compatibility mode.
Environment-Specific Commands
Linux (systemd)
sudo systemctl start dockersudo systemctl enable docker # auto-start on bootsudo usermod -aG docker $USER && newgrp docker
macOS
Open Docker Desktop from ApplicationsOr: open -a DockerWait for the whale icon in the menu bar to stop animating
Windows
Start Docker Desktop from Start MenuIf WSL2 backend: ensure WSL is updated (wsl --update)Restart WSL if needed: wsl --shutdown then reopen terminal
Quick Diagnostic Path
- If sudo docker works but docker without sudo does not → Your user is not in the docker group. Run: sudo usermod -aG docker $USER and log out/in.
- If systemctl status docker shows "failed" → Check logs: journalctl -u docker.service -n 50 for the root cause.
- If Docker Desktop is running but CLI still fails → Check the Docker context: docker context ls — ensure "desktop-linux" is selected.
If This Still Fails, Check
- Rootless Docker installations use a different socket path (~/.docker/run/docker.sock) — set DOCKER_HOST accordingly
- Snap-installed Docker on Ubuntu has a different service name: snap.docker.dockerd
- Corporate VPN or firewall software may block the Docker socket — try disconnecting VPN to test
Full diagnostic sequence for Docker daemon issues
# Check daemon status
sudo systemctl status docker
# If inactive, start it
sudo systemctl start docker
# Verify socket exists
ls -la /var/run/docker.sock
# srw-rw---- 1 root docker 0 ... /var/run/docker.sock
# Test connection
docker infoOS-Specific Behavior
Docker Desktop vs Colima on macOS: Socket Path Conflicts
/var/run/docker.sock. Colima — a popular lightweight alternative, especially on Apple Silicon — requires manual startup: colima start. If you recently switched from Docker Desktop to Colima or vice versa, the DOCKER_HOST environment variable may point to the wrong socket path.
Docker Desktop uses unix:///var/run/docker.sock. Colima uses unix://~/.colima/default/docker.sock. If both were installed and one is running while the other is not, Docker CLI commands try to connect to the wrong socket and report "daemon not running" even though a daemon is actually running.
Run docker context ls to see all configured Docker contexts and which is active. docker context use desktop-linux switches to Docker Desktop's context; docker context use colima switches to Colima. Setting DOCKER_CONTEXT=colima in your shell profile ensures the correct daemon is always targeted.
On Linux, sudo systemctl status docker shows the daemon status. If it is failed or inactive, sudo systemctl start docker restarts it. Adding your user to the docker group (sudo usermod -aG docker $USER) followed by logging out and back in eliminates the need for sudo on all subsequent Docker commands.Optional follow-up
Some users ask whether saving fixes for recurring errors would be useful when the same issue appears again.
Was this explanation helpful?
Frequently Asked Questions
How do I start Docker?
Run sudo systemctl start docker or start Docker Desktop.
How do I add user to docker group?
Run sudo usermod -aG docker $USER then log out and back in.
Related Resources
Also Known As
- Docker container error
- Docker build failure
- Container runtime error
- Docker daemon error
Common Search Variations
- "docker container won't start"
- "docker build error fix"
- "docker image not found"
- "container exited with error"
- "docker daemon not responding"
- "fix docker network error"
Related Errors
Still Stuck?
Paste a different error message or upload a screenshot to get help instantly.