How to fix Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? in Docker
The Docker daemon is not running or your user lacks permission to access the Docker socket. Start the daemon service or add your user to the docker group.
Quick fix
Fixes Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
# On Linux with systemd
sudo systemctl status docker
# Or check if the process is running
ps aux | grep dockerd- Check if Docker daemon is running
- Start the Docker service
- Enable Docker to start on boot
- Add your user to the docker group (Linux)
# On Linux with systemdsudo systemctl status docker# Or check if the process is runningps aux | grep dockerdCannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
What this error means
This error occurs when the Docker CLI cannot communicate with the Docker daemon (dockerd). The daemon is the background service that manages containers, images, and networks. Without it running, no Docker commands can execute. The Docker socket at `/var/run/docker.sock` is a Unix socket that acts as the communication channel between the CLI and the daemon. If the daemon isn't running, or your user doesn't have permission to access this socket, you'll see this error.
Typical symptoms
- All Docker commands fail with the same error message
- docker ps, docker run, docker images all return the socket error
- The error appears immediately without any delay
- Works when running with sudo but fails without it
Common causes
- Docker daemon service is not running
- Docker was recently installed but the service was not started
- System was rebooted and Docker is not configured to start on boot
- Current user is not in the docker group (Linux)
- Docker Desktop is not running (macOS/Windows)
- Docker socket file has incorrect permissions
- Docker was uninstalled or corrupted
How to fix "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
First, verify whether the Docker service is active:
# On Linux with systemd
sudo systemctl status docker
# Or check if the process is running
ps aux | grep dockerdIf the service is inactive or the process isn't running, proceed to start it.
Start the Docker daemon using your system's service manager:
# On Linux with systemd
sudo systemctl start docker
# On older systems with SysVinit
sudo service docker start
# On macOS/Windows
# Open Docker Desktop applicationAfter starting, verify it's running with docker info.
To prevent this issue after reboots, enable the Docker service:
sudo systemctl enable dockerThis creates a symlink so Docker starts automatically when your system boots.
If Docker runs with sudo but not without it, add your user to the docker group:
sudo usermod -aG docker $USERImportant: Log out and log back in for the group change to take effect. Alternatively, run newgrp docker to activate the group in your current session.
Check that the Docker socket exists and has correct permissions:
ls -la /var/run/docker.sockThe socket should be owned by root:docker with permissions srw-rw----. If permissions are wrong:
sudo chmod 660 /var/run/docker.sock
sudo chown root:docker /var/run/docker.sockAdvanced notes
Rootless Docker: If you're using rootless Docker, the socket path differs. Check $XDG_RUNTIME_DIR/docker.sock or set the DOCKER_HOST environment variable accordingly.
WSL2 Users: Ensure Docker Desktop's WSL2 integration is enabled in Settings โ Resources โ WSL Integration. The Docker daemon runs in a separate WSL2 distro managed by Docker Desktop.
SELinux: On systems with SELinux enabled, you may need to adjust contexts: sudo chcon -t container_runtime_exec_t /usr/bin/dockerd
Frequently asked questions
- What does "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is" mean?
- This error occurs when the Docker CLI cannot communicate with the Docker daemon (dockerd). The daemon is the background service that manages containers, images, and networks. Without it running, no Docker commands can execute.
- How do I fix "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is"?
- The Docker daemon is not running or your user lacks permission to access the Docker socket. Start the daemon service or add your user to the docker group.
- What causes "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is"?
- Docker daemon service is not running Docker was recently installed but the service was not started System was rebooted and Docker is not configured to start on boot
- Is the "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.
Official resources & further reading
- ๐Docker Official Documentation
- ๐ฌStack Overflow Discussion(Stack Overflow)
- ๐