How to install specific docker version from apt-cache policy docker-ce candidate list
Mia Lopez
Command "Docker-ce" list all candidates
root@ubuntu:/home/master# apt-cache policy docker-ce
docker-ce: Installed: (none) Candidate: 5:19.03.6~3-0~ubuntu-xenial Version table: 5:18.09.9~3-0~ubuntu-bionic 500 500 bionic/stable amd64 PackagesThen when issue the command using the string value from the candidate list fails
root@ubuntu:/home/master# sudo apt-get install docker-ce=18.03.1~ce~3-0~ubuntu-xenial docker-ce-cli=18.03.1~ce~3-0~ubuntu-xenial containerd.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Version '18.03.1~ce~3-0~ubuntu-xenial' for 'docker-ce' was not found
E: Version '18.03.1~ce~3-0~ubuntu-xenial' for 'docker-ce-cli' was not foundHow can i do to install an specific version from the list(the list is not complete because Ask Ubuntu don't allow me to paste more than 8 links)
I require this because the newest version 19.xx.xx is not compatible/supported by Kubernetes and cluster build fails.
2 Answers
Here the answer to how to install the desired docker version:
Update the apt package index
sudo apt-get updateTo install a specific version of Docker Engine - Community, list the available versions in the repo, then select and install
apt-cache madison docker-ce
Then finally select the version to install from the listed ones
sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu
This will help a lot to people getting into the docker world, Enjoy!
1You double-clicked the version in apt-cache's output, expecting to select it whole. But at least gnome-terminal treats colon as a separator for selection!
So you lost the leading 5: from the version.
Got stumped at the same problem just now, and it surprised the heck out of me! I guess colons in package versions are quite rare.