Docker has a official installation guide for Debian . I followed all the steps that are mentioned in the guide.

However in the end i faced the following error

Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package docker-ce-cli is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package containerd.io is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'docker-ce' has no installation candidate
E: Package 'docker-ce-cli' has no installation candidate
E: Package 'containerd.io' has no installation candidate

After facing the issue i tried multiple solutions available on the web however they didn’t worked.

Then i noticed the 3rd step in the docker guide tell us to run the following command :-

<strong>Command
</strong>echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

<strong>Output</strong>
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] <a href="https://download.docker.com/linux/debian">https://download.docker.com/linux/debian</a>   n/a stable

From the above command i removed

> /dev/null so that i can see the output

I visited the url and found out there various distributions are listed but in the output we are getting n/a stable

Then i thought i should try to replace the n/a with bullseye in the /etc/apt/sources.list.d/docker.list file

Old repo link
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian   n/a stable

Changed repo link
deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bullseye stable

After changing the n/a stable to bullseye stable i simply run the following commands

 sudo apt-get update
 sudo apt-get install docker-ce docker-ce-cli containerd.io

After that docker was installed and i tested it by running the below command

sudo docker run hello-world