Cannot Connect to the Docker Daemon on macOS: How to Fix It

If you’re using Docker on macOS and encountering the error:

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

…you’re not alone. This is one of the most common issues Docker users face on macOS, and it usually points to a problem with the Docker Desktop app or Docker daemon itself.

In this blog post, we’ll explain why this error happens, how to fix it, and how to prevent it from happening in the future.


🚨 What Causes This Error?

This error means the Docker CLI (docker) cannot communicate with the Docker daemon, which is responsible for running containers.

On macOS, Docker doesn’t run natively—it uses Docker Desktop, which runs Docker inside a lightweight Linux VM. If the Docker daemon inside that VM is not running, you’ll see this error.


✅ Fix 1: Ensure Docker Desktop Is Running

This is the most common solution:

  1. Open Docker Desktop from Spotlight or Applications.
  2. Wait for it to start—look for:
    • “Docker Desktop is running” message
    • A green whale icon 🐳 in the menu bar

If Docker is stuck on “Starting…”, try quitting and restarting it.


✅ Fix 2: Restart Docker Desktop

If Docker Desktop is already running but you still see the error:

  • Click the Docker whale icon in the macOS menu bar
  • Select Troubleshoot > Restart Docker

This can fix temporary issues with the background Docker daemon.


✅ Fix 3: Reset Docker Desktop

If restarting doesn’t help:

  1. Click the whale icon → Troubleshoot
  2. Choose “Reset to factory defaults”

⚠️ Warning: This will remove all containers, images, volumes, and settings. Use with caution.


✅ Fix 4: Check Docker Daemon Logs

Still not working? Inspect the logs:

  • Open Docker Desktop
  • Click Troubleshoot > Run Diagnostics
  • View logs under:
    ~/Library/Containers/com.docker.docker/Data/log

Look for errors related to startup, permissions, or system compatibility.


✅ Fix 5: Reinstall Docker Desktop

If the daemon still won’t start:

  1. Uninstall Docker Desktop:
    • Open Docker Desktop → Preferences → Troubleshoot → Uninstall
  2. Download the latest version from Docker’s official site
  3. Reinstall and launch

✅ Fix 6: Use docker context (Advanced)

If you’re working with multiple Docker environments (like remote Docker or WSL), make sure the correct context is active:

docker context ls
docker context use default

This ensures the CLI is pointed at Docker Desktop’s local context.


✅ Fix 7: Check for Conflicts (VPNs, Antivirus)

Some security tools or VPNs (like Cisco AnyConnect, CrowdStrike, etc.) may block Docker’s virtual network interfaces. Try disabling them temporarily and restarting Docker.


🛡️ Prevention Tips

  • Enable “Start Docker Desktop at login” in preferences.
  • Keep Docker Desktop updated—older versions may stop working after OS updates.
  • Avoid force quitting Docker from Activity Monitor—always use Quit Docker Desktop from the menu bar.

📝 Conclusion

If you see “Cannot connect to the Docker daemon” on macOS, it’s almost always because Docker Desktop isn’t running properly. A restart or reinstall usually resolves it. With proper configuration and attention to system conflicts, you can avoid future interruptions and keep Docker running smoothly.


🔑 Quick Troubleshooting Checklist

ProblemFix
Docker not startingLaunch Docker Desktop manually
Stuck on “Starting…”Restart Docker via menu bar
CLI cannot connectdocker context use default
Still brokenReset to factory defaults or reinstall
Security/VPN interferenceTemporarily disable and retest
Sharing Is Caring:

Leave a Comment