Skip to main content
When Docker commands fail to communicate with the Docker daemon, follow these steps to diagnose and resolve the issue.

1. “Cannot connect to the Docker daemon” Error

If you encounter:
the Docker Engine service (daemon) isn’t reachable. Determine if you’re targeting a local socket or a remote host.

a. Remote Access via DOCKER_HOST

Set the DOCKER_HOST environment variable to point at your remote Docker endpoint:
When using port 2376, ensure you have valid certificates configured on both client and server.
If the error persists, SSH into the remote host and check the Docker service status.

2. Checking the Docker Service Status

On most Linux distributions with systemd, Docker runs as a service. Verify its state:
A healthy daemon appears as:
If you see inactive or dead:
Start or restart the service:

3. Inspecting Service Logs

Use journalctl to pinpoint errors and warnings:
Example log excerpt:
Adjust the --since flag to narrow down log entries for faster troubleshooting.

4. Verifying Daemon Configuration

Inspect /etc/docker/daemon.json for JSON syntax errors or conflicting settings:
A conflict between daemon flags (in daemon.json) and CLI or systemd overrides can prevent Docker from starting. Remove duplicate host or TLS settings.
After any change, reload and restart:

5. Ensuring Sufficient Disk Space

Docker stores images, containers, and volumes under /var/lib/docker. A full filesystem can crash the daemon.
  1. Check disk usage:
    Example:
  2. Clean up unused resources:
Pruning operations are irreversible. Use docker system df to preview reclaimable space.

6. Examining System Information and Events

Once the daemon is running, validate your environment:
Sample output:
To view real-time Docker events (container lifecycle, network changes, etc.):

Further Reading

With these steps—verifying connection methods, service status, logs, configuration, disk space, and system information—you can reliably troubleshoot Docker daemon issues.

Watch Video