Fix “Failed to Start docker.service: Unit Not Found” on Linux

“Failed to start docker.service: Unit docker.service not found” means systemd can’t find a Docker service on your system. Usually Docker Engine isn’t installed, or it was installed in a way that doesn’t create docker.service, such as the Snap package or only the Docker CLI. Check with systemctl list-unit-files | grep -i docker. If nothing shows up, install Docker Engine from Docker’s official repository, then run sudo systemctl enable --now docker. On WSL, the cause is often that systemd isn’t turned on.

Here’s how to find which case you’re in and fix it.

Step 1: Find out how Docker is installed

Run these commands and compare the results to the table:

systemctl list-unit-files | grep -i docker
which docker
snap list 2>/dev/null | grep docker

Linux terminal showing the Failed to start docker.service Unit docker.service not found error and a command to check for Docker unit files
(1) The error message, and (2) the command that shows which Docker services exist. (Illustration)
What you see What it means Fix
No docker unit files, and docker not found Docker Engine isn’t installed Fix 1
which docker shows /snap/bin/docker Docker is installed as a Snap, which uses snap.docker.dockerd Fix 2
docker works but no docker.service Only the CLI is installed, or it talks to Docker Desktop or a remote host Fix 1 or check Docker Desktop
You’re in WSL and get “System has not been booted with systemd” systemd isn’t enabled in WSL Fix 3
docker.service shows as masked The service was masked Fix 4

Fix 1: Install Docker Engine from Docker’s repository (Ubuntu and Debian)

  1. Remove conflicting packages:
    for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove -y $pkg; done
  2. Add Docker’s GPG key and repository:
    sudo apt-get update
    sudo apt-get install -y ca-certificates curl
    sudo install -m 0755 -d /etc/apt/keyrings
    sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  3. Install Docker Engine:
    sudo apt-get update
    sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  4. Start Docker and turn it on at boot:
    sudo systemctl enable --now docker
  5. Test it:
    sudo docker run hello-world

On Debian, replace ubuntu with debian in the two URLs. For Fedora, RHEL, and other distributions, follow the matching instructions in Docker’s official documentation at docs.docker.com, which change from time to time.

Ubuntu’s own docker.io package also creates docker.service. If you prefer it, run sudo apt install docker.io and then sudo systemctl enable --now docker.

Fix 2: Docker installed as a Snap

The Snap version doesn’t use docker.service. Manage it with Snap instead:

  • Start it: sudo snap start docker
  • Check it: sudo snap services docker
  • Or with systemd: sudo systemctl start snap.docker.dockerd

Many guides and tools expect docker.service. If that’s causing problems, remove the Snap with sudo snap remove docker and use Fix 1.

Fix 3: Running Docker in WSL

  1. In your WSL distro, edit the config file: sudo nano /etc/wsl.conf
  2. Add these lines:
    [boot]
    systemd=true
  3. Save the file, then in Windows PowerShell run wsl --shutdown.
  4. Reopen your distro and run sudo systemctl start docker.

If you use Docker Desktop for Windows with WSL integration, you don’t need docker.service inside WSL at all. Start Docker Desktop in Windows and turn on integration for your distro in Settings > Resources > WSL integration.

Fix 4: The service is masked or systemd needs reloading

  • Reload systemd after installing: sudo systemctl daemon-reload
  • Unmask the service: sudo systemctl unmask docker.service docker.socket
  • Then start it: sudo systemctl start docker

Run Docker without sudo (optional)

Add your user to the docker group with sudo usermod -aG docker $USER, then log out and back in. Members of the docker group effectively have root access, so only add trusted users.

Check that it’s working

  • systemctl status docker should show active (running).
  • docker version should show both a Client and a Server section.

Frequently asked questions

What’s the difference between docker.io and docker-ce?

docker.io is packaged by Ubuntu and Debian. docker-ce comes from Docker’s own repository and is usually newer. Both create docker.service.

Why does “sudo service docker start” say unrecognized service?

For the same reason: Docker Engine isn’t installed as a system service. Follow Fix 1.

Can I use Docker without systemd?

Yes. You can start the daemon manually with sudo dockerd &, but it won’t start automatically at boot. systemd is the recommended way.