Introduction

You're trying to run Docker commands but the Docker daemon is not running or not accessible. Docker CLI can't communicate with the Docker daemon, resulting in connection refused or is the docker daemon running? errors. This prevents all Docker operations.

Symptoms

```bash $ docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running on this host?

$ docker run hello-world docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. See 'docker run --help'.

$ docker info Client: Context: default Debug Mode: false Server: ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

$ sudo systemctl status docker Unit docker.service could not be found.

$ docker-compose up ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running? ```

Common Causes

  1. 1.Docker service not started: Service hasn't been started or enabled
  2. 2.Docker not installed: Docker Engine not installed properly
  3. 3.Socket file missing: /var/run/docker.sock doesn't exist
  4. 4.Permission issues: User not in docker group
  5. 5.Service crashed: Docker daemon crashed due to error
  6. 6.Configuration errors: Invalid daemon.json causing startup failure
  7. 7.Systemd not available: Running in non-systemd environment
  8. 8.Resource issues: Out of memory or disk space

Step-by-Step Fix

Step 1: Check Docker Service Status

First, check if Docker is installed and running:

On Linux (systemd): ```bash # Check service status sudo systemctl status docker

# Check if service is enabled sudo systemctl is-enabled docker

# Check Docker installation which docker docker --version ```

On macOS: ```bash # Check if Docker Desktop is running ps aux | grep -i docker

# Or check the app ls /Applications/Docker.app ```

On Windows: ```powershell # Check Docker Desktop service Get-Process -Name "Docker Desktop"

# Check service Get-Service -Name "com.docker.service" ```

Step 2: Start Docker Service

Start the Docker daemon:

On Linux (systemd): ```bash # Start Docker service sudo systemctl start docker

# Enable Docker to start on boot sudo systemctl enable docker

# Check status sudo systemctl status docker

# Start Docker socket sudo systemctl start docker.socket ```

On Linux (without systemd): ```bash # Start Docker daemon manually sudo dockerd &

# Or with init.d sudo service docker start ```

On macOS: ```bash # Start Docker Desktop open /Applications/Docker.app

# Or from command line /Applications/Docker.app/Contents/MacOS/Docker &

# Wait for Docker to start sleep 30 docker info ```

On Windows: ```powershell # Start Docker Desktop Start-Process "C:\Program Files\Docker\Docker\Docker Desktop.exe"

# Or start the service Start-Service -Name "com.docker.service" ```

Step 3: Check Docker Socket

Verify the socket exists and has correct permissions:

```bash # Check if socket exists ls -la /var/run/docker.sock

# Expected output: # srw-rw---- 1 root docker 0 Jan 1 12:00 /var/run/docker.sock

# Check socket permissions stat /var/run/docker.sock

# If socket missing, restart Docker sudo systemctl restart docker

# Check Docker daemon is creating socket sudo ls -la /var/run/docker*

# Check Docker context docker context ls

# Use default context docker context use default ```

Step 4: Fix Permission Issues

Add your user to the docker group:

```bash # Check if user is in docker group groups $USER

# Add user to docker group sudo usermod -aG docker $USER

# Apply group changes (log out and back in, or:) newgrp docker

# Or restart your session # On Linux: log out and log back in # On macOS/Windows: restart Docker Desktop

# Verify permissions ls -la /var/run/docker.sock

# If still having issues, fix socket permissions sudo chmod 666 /var/run/docker.sock

# For permanent fix sudo chmod 660 /var/run/docker.sock sudo chown root:docker /var/run/docker.sock ```

Step 5: Check Docker Configuration

Invalid configuration can prevent startup:

```bash # Check for configuration file ls -la /etc/docker/daemon.json

# Validate JSON syntax cat /etc/docker/daemon.json | jq .

# If invalid JSON, fix or remove sudo mv /etc/docker/daemon.json /etc/docker/daemon.json.backup

# Restart Docker sudo systemctl restart docker

# If jq not available, check manually python3 -m json.tool /etc/docker/daemon.json ```

Check for common configuration errors: ```bash # View current config sudo cat /etc/docker/daemon.json

# Minimal valid config echo '{}' | sudo tee /etc/docker/daemon.json

# Common valid configuration sudo tee /etc/docker/daemon.json <<EOF { "storage-driver": "overlay2", "log-driver": "json-file", "log-opts": { "max-size": "10m", "max-file": "3" } } EOF

# Restart Docker sudo systemctl restart docker ```

Step 6: Check Docker Logs

Look for startup errors in logs:

```bash # View Docker daemon logs sudo journalctl -u docker.service

# View recent logs sudo journalctl -u docker.service -n 50

# Follow logs sudo journalctl -u docker.service -f

# Check systemd logs sudo journalctl -xe

# On non-systemd systems cat /var/log/docker.log cat /var/log/upstart/docker.log

# Check Docker daemon output directly sudo dockerd --debug ```

Step 7: Check Resources

Ensure system has enough resources:

```bash # Check available memory free -h

# Check disk space df -h

# Check Docker data directory df -h /var/lib/docker

# Check inodes df -i /var/lib/docker

# Check for zombie processes ps aux | grep -i docker

# Kill any stuck processes sudo pkill -9 dockerd

# Clean up and restart sudo rm -rf /var/run/docker.sock sudo systemctl start docker ```

Step 8: Reinstall Docker

If Docker is corrupted, reinstall:

On Linux (Ubuntu/Debian): ```bash # Remove Docker sudo apt-get remove docker docker-engine docker.io containerd runc

# Remove Docker data (caution: deletes all images, containers, volumes) sudo rm -rf /var/lib/docker sudo rm -rf /var/lib/containerd

# Install Docker curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh

# Add user to docker group sudo usermod -aG docker $USER

# Start Docker sudo systemctl start docker sudo systemctl enable docker ```

On macOS: ```bash # Uninstall Docker Desktop /Applications/Docker.app/Contents/MacOS/Docker uninstall

# Reinstall from Docker website or Homebrew brew install --cask docker

# Open Docker Desktop open /Applications/Docker.app ```

On Windows: ```powershell # Uninstall Docker Desktop # Use Settings > Apps > Docker Desktop > Uninstall

# Reinstall from Docker website # Download and run the installer ```

Step 9: Check Environment Variables

Environment variables can affect connection:

```bash # Check Docker environment variables env | grep -i docker

# Common variables that might cause issues echo $DOCKER_HOST echo $DOCKER_TLS_VERIFY echo $DOCKER_CERT_PATH

# Unset problematic variables unset DOCKER_HOST unset DOCKER_TLS_VERIFY unset DOCKER_CERT_PATH

# Or use default socket export DOCKER_HOST=unix:///var/run/docker.sock

# Test connection docker info ```

Step 10: Use Docker Machine or Context

Check for Docker context issues:

```bash # List Docker contexts docker context ls

# Check current context docker context show

# Use default context docker context use default

# Create new context if needed docker context create my-context --docker "host=unix:///var/run/docker.sock"

# Use specific context docker context use my-context

# Check Docker machine (if using) docker-machine ls docker-machine env default eval $(docker-machine env default) ```

Verification

Confirm Docker is running and accessible:

```bash # Check service status sudo systemctl status docker

# Should show active (running)

# Test Docker CLI docker info

# Should show Docker client and server info

# Test run docker run --rm hello-world

# Should download and run hello-world successfully

# Check socket ls -la /var/run/docker.sock

# Should show socket file

# Check user permissions groups $USER

# Should include 'docker'

# Test without sudo docker ps ```

Docker should now be running and all commands should work without errors.

  • [Fix docker build cache invalidated unnecessary layers Issue in Docker-Errors](docker-build-cache-invalidated-unnecessary-layers)
  • [Fix Docker Build Cache Invalidation Optimization Issue in Docker](docker-build-cache-invalidation-optimization)
  • [Fix docker build context slow large files Issue in Docker-Errors](docker-build-context-slow-large-files)
  • [Fix docker build multi stage copy from not found Issue in Docker-Errors](docker-build-multi-stage-copy-from-not-found)
  • [Fix docker buildkit export local tar layer missing Issue in Docker-Errors](docker-buildkit-export-local-tar-layer-missing)

<script type="application/ld+json"> { "@context": "https://schema.org", "@type": "TechArticle", "headline": "Is the Docker Daemon Running? How to Fix Docker Daemon Not Running", "description": "Resolve Docker daemon connection errors and 'is the docker daemon running' messages with service checks, socket fixes, permissions, and startup recovery.", "url": "https://www.fixwikihub.com/fix-docker-daemon-not-running", "publisher": { "@type": "Organization", "name": "FixWikiHub", "url": "https://www.fixwikihub.com" }, "author": { "@type": "Person", "name": "FixWikiHub Editorial Team" }, "datePublished": "2025-11-19T14:05:25.549Z", "dateModified": "2025-11-19T14:05:25.549Z" } </script>