🎓 A1Learner
🔍
0 of 50 lessons completed

Fix "Cannot Connect to the Docker Daemon"

"Cannot connect to the Docker daemon" means the client cannot reach the daemon. Check in order: is the daemon running, is the app open, is the socket right.

The error, reproduced

Pointing the client at a dead socket shows the real error.

DOCKER_HOST=unix:///tmp/no-docker.sock docker ps

Check the daemon on Linux

This command shows whether the daemon service runs. It prints active when the daemon runs.

systemctl is-active docker

Example

DOCKER_HOST=unix:///tmp/no-docker.sock docker ps

Key points

  • Daemon: the background service that does the Docker work.
  • First, check the daemon is running. On Linux, use systemctl status docker.
  • On Windows and macOS, check Docker Desktop is open and running.
  • On Windows, check the WSL 2 integration is turned on for your distribution.
  • The error names the socket it tried, so read the socket path in the message.

In this example, the client points at a socket with no daemon behind it. Docker answers with the cannot-connect error. The fix is to start the daemon, or open Docker Desktop, and try again.

Note

A stopped daemon is the most common cause. Start it before changing anything else.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

What is the first thing to check for a cannot-connect error?