If you’re seeing the error:
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
while working on macOS, you’re not alone. This is one of the most common issues Docker users face — and luckily, it’s easy to resolve once you understand the root cause.
In this post, we’ll walk through why this happens on macOS and how to fix it.
🐳 What Does This Error Mean?
The error indicates that the Docker CLI (docker) is unable to communicate with the Docker daemon — the core service responsible for managing containers.
On macOS, Docker doesn’t run as a native system service. Instead, it runs inside a lightweight virtual machine managed by Docker Desktop.
So if Docker Desktop is not running, the Docker CLI has no daemon to connect to.
✅ Step-by-Step Fixes
1. Check if Docker Desktop is Running
The most common reason for this error is that Docker Desktop isn’t running.
- Open the Applications folder
- Launch Docker Desktop
- Wait for the Docker icon in the menu bar to finish starting up (a green dot or “Docker is running” message)
Then re-run your Docker command.
docker ps
If Docker is up, this should now work without errors.
2. Restart Docker Desktop
If Docker Desktop is already running but you’re still seeing the error:
- Click the Docker icon in the macOS menu bar
- Go to Troubleshoot → Restart Docker
- Or use the gear icon → Restart
After restarting, try your command again.
3. Check Docker Daemon Status via Terminal
You can verify if the Docker daemon is running by executing:
docker info
If you still get the “cannot connect” error, the daemon isn’t available yet — wait a few more seconds and retry.
4. Check Docker Socket Permission (Advanced)
In rare cases, socket file permissions might be the issue:
ls -la /var/run/docker.sock
Expected output:
srw-rw---- 1 root docker 0 Aug 1 10:00 /var/run/docker.sock
If your user isn’t part of the docker group, it can’t connect. But on macOS, Docker manages this internally, so this step is rarely needed unless using a custom Docker setup.
5. Update Docker Desktop
Outdated versions of Docker Desktop may have bugs that prevent the daemon from starting properly.
- Open Docker Desktop → Settings → Check for Updates
- Download and install the latest version
You can also download the latest version from: https://www.docker.com/products/docker-desktop/
6. Reinstall Docker Desktop (Last Resort)
If nothing else works:
- Quit Docker Desktop
- Delete Docker from Applications
- Download the latest version
- Reinstall and restart your system
You won’t lose containers or images unless you choose to remove all Docker data during uninstall.
🔁 Common Scenarios That Trigger This
- Restarting your Mac without re-opening Docker
- Running
dockercommands immediately after login (before Docker finishes starting) - Running Docker in a CI/CD script without confirming the daemon is ready
🧠 Quick Tip: Add Docker to Login Items
To avoid manually starting Docker each time:
- Go to System Settings → Users & Groups
- Select your user → Login Items
- Add Docker Desktop
This ensures Docker starts up every time you log in.
📌 Summary
| Issue | Fix |
|---|---|
| Docker Desktop not running | Start Docker from Applications |
| Docker stuck or slow | Restart from the menu bar |
| Still not working | Check updates, reinstall if needed |
| CLI can’t connect | Wait for daemon startup, retry command |
🧭 Conclusion
The “Cannot connect to the Docker daemon” error on macOS is usually a sign that Docker Desktop isn’t running or hasn’t fully initialized. Most of the time, a quick restart or waiting a few seconds after boot is all it takes.
By ensuring Docker Desktop is running and up to date, you can get back to building, testing, and deploying with ease.