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

Docker Daemon Won't Start on Ubuntu 22.04 – Fix It Now

Docker daemon failing to start on Ubuntu 22.04? Start here. I'll walk you through three fixes, from a 30-second restart to a deeper config repair.

The 30-Second Fix: Restart & Check Service Status

Before diving into logs or configs, let's make sure Docker's service is actually running. I've seen this trip up a lot of people—Docker can fail silently after an update or reboot.

Open a terminal and run:

sudo systemctl status docker

If you see something like Active: failed (Result: exit-code) or inactive (dead), try restarting it:

sudo systemctl restart docker

Then check again. If that spits back active (running), you're golden. If not, move to the next step. This works about 30% of the time—usually when the daemon just stumbled after an update or the socket got hung.

The 5-Minute Fix: Check Docker Daemon Logs

If a restart didn't stick, the daemon is crashing. Docker keeps its logs in /var/log/daemon.log or /var/log/syslog, but the quickest read is via journalctl. Run this to see the last 20 lines of Docker's fight:

sudo journalctl -u docker.service --no-pager -n 20

Look for common trouble signs:

  • "failed to start daemon: Error initializing network controller" – That's usually a Docker bridge or firewall conflict. I've fixed this by resetting Docker's network: sudo systemctl stop docker; sudo rm -rf /var/lib/docker/network; sudo systemctl start docker. Don't worry, this doesn't touch your containers or images—just the network config.
  • "could not create default bridge network" – Often from leftover iptables rules. Try sudo iptables -F then sudo iptables -P FORWARD ACCEPT, then restart Docker.
  • "permission denied" or "socket: permission denied" – Your user isn't in the docker group. Add yourself: sudo usermod -aG docker $USER, then log out and back in.

If you see "iptables: No chain/target/match by that name", Docker's trying to use iptables but it's not installed. Install it: sudo apt update && sudo apt install iptables. Yes, even on modern Ubuntu, Docker still leans on iptables by default unless you've switched to nftables.

One more thing: check your disk space. Docker won't start if the disk is full. Run df -h—if any partition is at 100%, clear space. I've seen a full /var partition kill Docker silently.

The 15+ Minute Fix: Edit Docker Daemon Configuration

If logs didn't point to a clear cause, your config file is the likely culprit. Docker's main config lives at /etc/docker/daemon.json. If it's missing, that's fine—Docker uses defaults. But if it's present and broken, things get ugly.

Check it with:

sudo cat /etc/docker/daemon.json

Look for these common mistakes:

  1. Invalid JSON. Missing commas, extra brackets. Use a JSON validator online or run python3 -m json.tool /etc/docker/daemon.json to check. If it fails, fix the syntax.
  2. Conflicting networking options. For example, setting both "bip": "172.17.0.1/16" and "default-address-pools" can cause a conflict. Remove the bip line if you have pools defined.
  3. Wrong directory paths. If you set "data-root" to a non-existent path, Docker won't start. Make sure the path exists and is writable: sudo mkdir -p /path/you/set; sudo chown root:root /path/you/set.

If you're running a custom Docker version or rootless Docker, check ~/.config/docker/daemon.json too. I've helped folks who swore they had no config, only to find a broken rootless one in their home directory.

A real-world scenario: I once saw a daemon fail because someone set "exec-opts": ["native.cgroupdriver=systemd"] but the system was using cgroups v1. Cgroups v2 became default in Ubuntu 21.10+. If you're on Ubuntu 22.04 with cgroups v2, the native driver works fine, but if you're on v1, you need "exec-opts": ["native.cgroupdriver=cgroupfs"]. Check your cgroups version: stat -fc %T /sys/fs/cgroup/. If it returns cgroup2fs, you're on v2.

If All Else Fails: Reinstall Docker

This is my nuclear option. Remove Docker completely, then reinstall. Here's the clean command sequence I use:

sudo systemctl stop docker
sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo rm -rf /var/lib/docker /var/lib/containerd /etc/docker
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io

This wipes all containers and images, so back up anything you need first. After the install, start Docker and test it with sudo docker run hello-world. If that works, you're back in business.

One last tip: if you're behind a corporate proxy, set the proxy in /etc/systemd/system/docker.service.d/http-proxy.conf. Docker ignores system-wide proxy settings sometimes. That's bitten me twice.

Related Errors in Linux & Unix
permission denied Fix 'permission denied' for /var/run/docker.sock on Ubuntu 22.04 bash: ./script: Permission denied Fix 'bash: ./script: Permission denied' on Linux Journal corruption detected Fix Journalctl Log Corruption in systemd Failed to start Docker Application Container Engine Docker Daemon Won't Start on Ubuntu 22.04

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.