Skip to main content
DevOps & Docker · Developer Error Resolution Lab

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

Start the Docker daemon, fix docker.sock permissions, or switch to the right Docker context on Linux, macOS, WSL2 and CI runners.

Triggered Error Message:

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

Customize Solution for Your Environment
# Linux: start the daemon
sudo systemctl start docker

# Permission denied on docker.sock? add yourself to the docker group
sudo usermod -aG docker $USER && newgrp docker

# macOS / Windows: open Docker Desktop (or: colima start)

# Wrong context? switch to "default"
docker context use default
docker info

Root Cause & Mechanism Analysis

Why does this error occur?

The Docker CLI talks to the daemon (dockerd) through a Unix socket. The error appears when the daemon is stopped, Docker Desktop is not running, your user lacks permission on `/var/run/docker.sock`, or the CLI points to a stale Docker context.

Frequently Asked Questions

Is adding my user to the docker group safe?
It grants root-equivalent access to the host. It is fine on a personal dev machine; on shared servers prefer rootless Docker or sudo.
Why does this happen inside WSL2?
Docker Desktop's WSL integration is disabled for your distro. Enable it in Docker Desktop → Settings → Resources → WSL Integration.
DEVSECOPS & CI/CD PARTNER2 Slots Open

Need Zero-Knowledge .env Secret Sync Across Your Engineering Team?

Explore Castov Env Vault for client-side AES-256-GCM encrypted environment sharing, or sponsor this engineering hub.

Browse All 69 Guides