How to Fix “package docker-ce has no installation candidate” Error

Docker is a tool that was designed for software developers to be able to transport and deliver their applications to others in a packaged form. These packages are known as containers in Docker terms. Docker-CE or (Community Edition) is the re-launched version of the Docker software. While attempting to install this tool on your system, the “package docker-ce has no installation candidate” issue can pop up.

This article will give you knowledge about the reasons for this error and also provide details about its solutions.

How to Fix the “package docker ce has no installation candidate” Error?

This section provides detailed reasoning and will also state the possible solutions to fix the error. Let’s dig into the reasons and their respective solutions:

Reason: Docker Repository Missing

This error is most commonly invoked when the Docker-CE installation is attempted directly without its repository being added to the system. First, let’s see the error statement when we attempt to install this software directly using the command:

$ sudo apt install docker-ce

Solution: Add Repository of Docker-CE and its GPG Key

How to install Kali Linux in Window...

The best solution for this issue is to add and set up the Docker repository before the installation. To carry out the successful installation of the Docker-CE, just perform the following steps:

Step 1: Update System Packages

First and most obvious step is to update your system repositories using the command below:

$ sudo apt update

Step 2: Add the GPG Key oF Docker’s Repository

Now, you need to get the GPG key for the Docker Repository using the command shown below as it will allow the Repository to be run:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/docker-archive-keyring.gpg

Step 3: Add the Docker Repository

Once you get the key from the step above, now the repository itself can be downloaded by executing the following command in the terminal:

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

Step 4: Update the Core Libraries

Update the repositories to use the new Docker repository with the following command:

$ sudo apt install update

Step 5: Install Docker

Now, the command provided below will install the Docker-CE without any error:

$ sudo apt install docker-ce docker-ce-cli containerd.io

As the snippet above demonstrates, the “package docker ce has no installation candidate” problem has been resolved, and the Docker-CE can be installed easily.

That’s all from this guide!

Conclusion

The “package docker ce has no installation candidate” issue occurs when the Docker Repository is not installed on your system and you attempt to install Docker-CE directly. This can be resolved by adding the GPG key and then the repository. This article has explained the reasons that invoke this error, and the solution is also demonstrated.