Cannot connect to the Docker daemon
The “Cannot connect to the Docker daemon” error means the Docker CLI can communicate with the Docker daemon socket but the daemon is not running or your user lacks permission. This is usually a service or permissions issue.
What It Means
The docker command tried to reach the Docker daemon via /var/run/docker.sock but the daemon was unreachable. The socket file may be missing, the daemon process may be stopped, or your user is not authorized to access the socket.
Why It Happens
- The
dockerservice is not started or has crashed. - The Docker daemon socket is not listening.
- Your user is not in the
dockergroup and is running withoutsudo. - The system was rebooted and Docker was not configured to start automatically.
How to Fix It
1. Start the Docker daemon
sudo systemctl start dockerEnable Docker to start on boot:
sudo systemctl enable docker2. Check the daemon status
sudo systemctl status dockerLook for active (running) in the output. If it failed, inspect the logs:
journalctl -u docker --no-pager -n 503. Add your user to the docker group
sudo usermod -aG docker $USERImportant: Log out and log back in (or run newgrp docker) for the group change to take effect. Restart your terminal session.
4. Restart the socket (if applicable)
sudo systemctl restart docker.socket5. Verify the fix
docker run hello-worldIf you see the “Hello from Docker!” message, the daemon is reachable.
FAQs
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro