"Cannot connect to the Docker daemon"
Either the daemon is not running, or the user has no permission to reach its socket.
What you see
Every docker command fails with the same message. The wording differs subtly between the two causes and that difference is the diagnosis.
What is actually wrong
"Is the docker daemon running?" means it is not. "Permission denied while trying to connect" means it is, and this user cannot reach the socket.
Codes and articles
Fixes (2)
Grant socket access, understanding what it means
Permission denied.
Confirm the socket and its ownership.
ls -l /var/run/docker.sockid
Understand what adding a user to the docker group grants before doing it: it is equivalent to root. Anyone in that group can start a container that mounts the host filesystem and read or write anything on it.
This is presented everywhere as a convenience step and it is a privilege grant. On a shared or production machine it deserves a decision, not a reflex.
Where that is acceptable, add the user and start a new session.
sudo usermod -aG docker $USERnewgrp dockerdocker info | head -5
Where it is not, use sudo for docker commands, or run rootless Docker, which gives the same convenience without host-level privilege.
dockerd-rootless-setuptool.sh installexport DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock
For Podman, no daemon and no group are involved at all — rootless is the default.
podman info | head -5
docker psFind out why the daemon will not run
The daemon is not running.
Read why it stopped.
systemctl status docker --no-pager -lsudo journalctl -u docker -n 60 --no-pager
Check the disk. A full /var stops the daemon and is the most common cause.
df -h /var/lib/dockersudo du -sh /var/lib/docker/* 2>/dev/null | sort -h | tail
Docker stores images, containers and volumes under /var/lib/docker and fills a small root partition quietly. The daemon then refuses to start with an error that does not mention disk space.
Validate the daemon configuration — a JSON syntax error stops it starting with a message that is easy to miss.
sudo cat /etc/docker/daemon.json | python3 -m json.toolReclaim space carefully. Check what would be removed before removing it.
docker system dfdocker system prune -a --dry-run 2>/dev/null || docker system df -v | head -30
Prune, being aware that -a removes every image not used by a running container, including ones you would have to rebuild or re-pull.
docker system prune -fdocker image prune -a -f
Volumes are not removed by default and that is deliberate — they hold data. Adding --volumes to a prune is how databases get deleted, so it should never be a reflex.
systemctl is-active docker && docker info | grep -E 'Server Version|Storage Driver|Docker Root'Where this stops. This write-up was written and checked by hand. It says what each step changes, how to confirm it worked and how to reverse it, and anything destructive is flagged before you reach it. If it does not match what your machine is doing, search the Support Centre for the exact code or message — and when something needs a person, get in touch.