Introduction
This article introduces the solution to the problem that docker-ce is unavailable when installing docker using Ubuntu's apt-get command.
error log
Package docker-ce is not available, but is referred to by another package
reason
There is no docker-ce installation package in the source of this version, so an error is reported. Solution: Use an old version of the docker repository (bionic is used here).
Solution
Add the following content to /etc/apt/sources.list.d/docker.list (create a new file if it does not exist)
deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable
The command is as follows:
cd /etc/apt/sources.list.d;
sudo touch docker.list;
sudo chmod 666 docker.list;
sudo echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" > docker.list;
invalid method
Some people online say this method works, but I tested it and it didn't work.
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
How to remove
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"