Skip to content

Docker Desktop Ubuntu Installation: Fix "docker-ce-cli not installable" Error

Problem Statement

When installing Docker Desktop on Ubuntu Linux, users frequently encounter the frustrating error:

docker-desktop : Depends: docker-ce-cli but it is not installable
E: Unable to correct problems, you have held broken packages.

This occurs because Docker Desktop has a dependency on docker-ce-cli, but the Docker repository isn't properly configured in your system's package manager. Without this repository, APT cannot locate or install the required Docker components.

Solution: Configure Docker Repository First

The most reliable solution is to properly set up Docker's official repository before attempting to install Docker Desktop. This ensures all required dependencies are available to your package manager.

Step 1: Set Up Docker Repository

Open a terminal and run these commands to add Docker's official repository:

bash
# Install prerequisite packages
sudo apt install -y ca-certificates curl gnupg lsb-release

# Create keyring directory
sudo mkdir -p /etc/apt/keyrings

# Download and add Docker's GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

# Add Docker repository to APT sources
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Update package lists
sudo apt update -y

INFO

The $(lsb_release -cs) command automatically detects your Ubuntu version codename (e.g., jammy, focal). If you encounter issues, you may need to manually specify your Ubuntu version in the repository URL.

Step 2: Install Docker Desktop

After setting up the repository, install Docker Desktop:

bash
sudo apt install ./docker-desktop-<version>-<arch>.deb

Replace <version> and <arch> with your downloaded package details (e.g., docker-desktop-4.8.1-amd64.deb).

WARNING

You may see a permission warning at the end of installation:

Download is performed unsandboxed as root as file docker-desktop-<version>-<arch>.deb couldn't be accessed by user '_apt'

This warning is safe to ignore and doesn't affect functionality.

Alternative Solutions

Install Docker Engine First

If you prefer to install Docker Engine before Docker Desktop:

bash
# Install Docker Engine components
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Verify installation
docker --version

TIP

Docker Desktop and Docker Engine can coexist, but Docker Desktop uses its own isolated environment to prevent conflicts with existing Docker Engine installations.

Fix Broken Packages

If you encounter dependency issues during installation:

bash
sudo apt --fix-broken install

This command attempts to resolve broken dependencies and incomplete installations.

Clean Up Previous Installations

If you have previous Docker installations that might cause conflicts:

bash
# Remove existing Docker packages
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do
  sudo apt-get remove $pkg
done

Common Issues and Troubleshooting

Repository Version Mismatch

If your Ubuntu version doesn't match the repository configuration:

  1. Check your Ubuntu version:

    bash
    lsb_release -cs
  2. Edit the Docker repository file:

    bash
    sudo nano /etc/apt/sources.list.d/docker.list
  3. Replace the codename (e.g., change "wilma" to "jammy" for Ubuntu 22.04):

    deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable
  4. Update package lists:

    bash
    sudo apt update

Verification

After successful installation, verify Docker Desktop is working:

bash
docker --version
docker run hello-world

Understanding the Architecture

Docker Desktop for Linux differs from Docker Engine:

  • Docker Engine: The core Docker runtime that manages containers
  • Docker Desktop: A GUI application that provides an enhanced developer experience, including Docker Engine

Docker Desktop packages its own containerized version of Docker Engine, but still requires certain CLI components from the system repository.

Conclusion

The "docker-ce-cli not installable" error occurs because Docker Desktop depends on packages that are only available in Docker's official repository. By properly configuring this repository before installation, you ensure all dependencies are available to your package manager.

The recommended approach is:

  1. Set up Docker's official repository
  2. Update package lists
  3. Install Docker Desktop using apt install

This method is more reliable than attempting to install the .deb package directly without the proper repository configuration.