Fix: Cannot connect to the Docker daemon at unix:///var/run/docker.sock - Rocketeers

  [ Rocketeers ](/)   

[Login](https://rocketeersapp.com) 

 On this page

 Knowledge
---------

Fix: Cannot connect to the Docker daemon at unix:///var/run/docker.sock
=======================================================================

### [\#Development](https://rocketee.rs/index.php/development)

This error means your Docker client could not reach the Docker daemon. Either the daemon is not running, or your user does not have permission to talk to its socket.

 Published by [Mark van Eijk](https://rocketee.rs/index.php/author/mark-van-eijk) on June 23, 2026 · 1 minute read

1. [About the error](#content-about-the-error)
2. [Why do I see this error](#content-why-do-i-see-this-error)
3. [Solution: start the daemon](#content-solution-start-the-daemon)
4. [Solution: fix the permission denied case](#content-solution-fix-the-permission-denied-case)
5. [Still failing? Check the context](#content-still-failing-check-the-context)

[\#](#content-about-the-error "Permalink")About the error
---------------------------------------------------------

 ```
Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
Is the docker daemon running?

```

The `docker` command you type is just a client. It sends instructions to a background service, the Docker daemon (`dockerd`), over a Unix socket at `/var/run/docker.sock`. This error appears when the client cannot reach that daemon.

[\#](#content-why-do-i-see-this-error "Permalink")Why do I see this error
-------------------------------------------------------------------------

- The Docker daemon is not running.
- Your user is not allowed to access the socket (a permissions issue).
- Your client is pointed at the wrong Docker context or a stale `DOCKER_HOST`.

[\#](#content-solution-start-the-daemon "Permalink")Solution: start the daemon
------------------------------------------------------------------------------

On **macOS or Windows**, the daemon runs inside Docker Desktop. Make sure Docker Desktop is open and has finished starting (the whale icon stops animating).

On **Linux**, start and enable the service so it also comes back after a reboot:

 ```
sudo systemctl start docker
sudo systemctl enable docker

```

Check that it is actually running:

 ```
sudo systemctl status docker

```

[\#](#content-solution-fix-the-permission-denied-case "Permalink")Solution: fix the permission denied case
----------------------------------------------------------------------------------------------------------

If the daemon is running but you still see the error (often phrased as `permission denied while trying to connect`), your user is not in the `docker` group. Add it:

 ```
sudo usermod -aG docker $USER

```

Group membership only applies to new sessions, so log out and back in, or start a fresh shell with:

 ```
newgrp docker

```

Then verify:

 ```
docker run hello-world

```

[\#](#content-still-failing-check-the-context "Permalink")Still failing? Check the context
------------------------------------------------------------------------------------------

If Docker is running and you have permission, your client may be pointed somewhere else. List your contexts and confirm the active one:

 ```
docker context ls

```

Also check for a leftover environment variable overriding the socket:

 ```
echo $DOCKER_HOST

```

If `DOCKER_HOST` is set to something unexpected, unset it and try again. Once the daemon is reachable, you can [clean up unused Docker data with prune](/docker-prune) or [run a command in a container with docker exec](/docker-exec).

### Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

  Fill in your email address to receive updates  Subscribe 

#### More in [\#Development](https://rocketee.rs/index.php/development)

- [Install PHP memcached extension on macOS](https://rocketee.rs/index.php/install-php-memcached-extension-on-macos)
- [How to delete a local (and remote) Git branch](https://rocketee.rs/index.php/git-delete-local-branch)
- [git stash pop vs apply: save and restore changes](https://rocketee.rs/index.php/git-stash-pop)
- [How to clean up Docker with prune (images, volumes, system)](https://rocketee.rs/index.php/docker-prune)
- [What port does SSH use (and how to change it)](https://rocketee.rs/index.php/ssh-port)
- [How to checkout a Git tag](https://rocketee.rs/index.php/git-checkout-tag)

 [View all 12 articles →](https://rocketee.rs/index.php/development)
