Why am I still getting Docker daemon connection error?

Why do I still get “cannot connect to the Docker daemon at unix:///var/run/docker.sock. is the docker daemon running?” even after trying all known solutions?

I’ve been trying to run Scrapy Splash using Docker, but no matter what I try, I keep getting the error: cannot connect to the Docker daemon at unix:///var/run/docker.sock. is the docker daemon running?

Here’s what I’ve done so far:

Ran the container with and without sudo

Added my user to the docker group

Ran newgrp docker and rebooted

Verified that the dockerd and docker-containerd processes are running via ps aux

Despite all this, the same error persists. Has anyone faced a similar issue where Docker appears to be running, but commands still fail with this error? What else can I try to resolve this?

Yep, been there! One thing that finally helped me was checking who owns the Docker socket itself.

Even if Docker is running and you’re in the Docker group, the permissions on /var/run/docker.sock might be off. Try running:


ls -l /var/run/docker.sock

It should be something like srw-rw---- root docker. If it’s not, restart the Docker service:

sudo systemctl restart docker

Also, double-check that your shell session actually picked up the new group permissions. newgrp docker doesn’t always work cleanl, sometimes logging out and back in does the trick.

Had a similar issue with Splash, and my fix was oddly related to the WSL2/Docker Desktop setup (if you’re using Windows or WSL, that could be it).

If Docker is installed via Docker Desktop but not properly exposed to your shell, it won’t connect. Running this helped in my case:


export DOCKER_HOST=unix:///var/run/docker.sock

Also, try docker info, if that fails, your client really isn’t reaching the daemon.

Something I’ve seen in CI/CD environments is stale Docker daemon sockets. Even if processes are running, the socket might be corrupted or not linked properly. What worked:

Kill Docker completely:


sudo pkill -f docker

Then restart it fresh:

sudo systemctl start docker Also, make sure there’s no Docker rootless setup interfering. Run docker context ls, you should be using the default context. If it’s switched to rootless or a custom context, that might explain why the socket doesn’t work.