Likely causes
- •The Docker service is stopped or never started. Run 'systemctl status docker'. If it shows inactive (dead) or failed, this is the cause. It is common after a fresh install, a reboot where the service was not enabled, or a package upgrade.
- •The daemon crashed on start because of a bad config. The service shows failed and 'journalctl -u docker' contains errors about /etc/docker/daemon.json, a storage driver, or a full disk. A typo in daemon.json is the usual trigger.
- •The daemon is listening on a different socket than the client uses. The error names the default path, so the client is using the default socket. If Docker runs rootless, the daemon listens on /run/user/<uid>/docker.sock instead. Run 'ls -l /run/user/$(id -u)/docker.sock' and 'docker context ls'. If that socket exists, the daemon is up and the client is looking in the wrong place.
- •Docker is not installed, or runs in a different form (Snap, rootless, WSL). 'which docker' finds a client but no dockerd exists, or Docker was installed by Snap or in rootless mode. Rootless Docker uses a socket under /run/user/<uid>/docker.sock, not /var/run/docker.sock.
- •The socket file is missing or stale. The service is running but 'ls -l /var/run/docker.sock' says no such file. This can happen if the socket unit is stopped or /var/run (a link to /run) was cleaned.
How to fix it
1. Check whether the Docker service is running
Look at the state of the service. If it says active (running), skip to the socket step. If it says inactive or failed, continue.
systemctl status docker --no-pager2. Start Docker and enable it at boot
This starts the daemon. It does not restart anything that is already running. If the daemon is down, no containers are running anyway, but containers with a restart policy will start again once it is up.
sudo systemctl enable --now docker3. Read the logs if it fails to start
Look for the real reason: a JSON syntax error in /etc/docker/daemon.json, a bad storage driver, a port clash, or no free disk space.
sudo journalctl -u docker --no-pager -n 50 df -h /var/lib/docker4. Validate daemon.json if the log points at it
Check the file for syntax errors. If it is broken, fix it or move it aside (keep a copy), then start Docker again. Moving it aside drops your custom settings until you restore them.
sudo python3 -m json.tool /etc/docker/daemon.json sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.bak sudo systemctl restart docker5. Confirm the socket exists
You should see a socket file (it starts with 's') owned by root. If the socket is missing but the service is active, start the socket unit.
ls -l /var/run/docker.sock sudo systemctl enable --now docker.socket6. Point the client at the right socket if the daemon runs rootless
If Docker runs rootless, the daemon does not use /var/run/docker.sock. Set DOCKER_HOST to the rootless socket for your user. Add the line to your shell profile to keep it.
export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock docker context ls7. Install Docker if it is missing
If 'systemctl status docker' says the unit could not be found, install Docker Engine from the official Docker repository. On Ubuntu/Debian the package is docker-ce, on RHEL-family systems it is also docker-ce from Docker's repo. Distro packages named docker.io (Debian/Ubuntu) also work.
# Ubuntu/Debian (distro package) sudo apt-get update && sudo apt-get install -y docker.io # RHEL-family: add Docker's repo first, then sudo dnf install -y docker-ce docker-ce-cli containerd.io
Confirm it is fixed
The client should print both Client and Server sections without any connection error. If you only see the Client section followed by the error, the daemon is still unreachable.
docker version && docker run --rm hello-worldHow Opservo catches it early
Opservo discovers systemd services, flags units in a failed state and services that have restarted many times, and clusters journal errors into patterns, so a stopped or flapping docker service shows up as a finding.
Last updated 2026-11-30.