Install Docker with given version
Environment
Removing older version(Optional)
1 2
| sudo apt-get autoremove docker docker-ce docker-engine docker.io containerd runc sudo apt-get update
|
Preparing & Listing versions can be installed directly
Add repository via GPG
1 2 3 4 5
| sudo apt-get update sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update
|
Listing all avaliable versions
1
| sudo apt-cache madison docker-ce
|
It returns:
1 2 3 4
| docker-ce | 5:24.0.4-1~ubuntu.22.10~kinetic | https://download.docker.com/linux/ubuntu kinetic/stable amd64 Packages docker-ce | 5:24.0.4-1~ubuntu.22.10~kinetic | https://download.docker.com/linux/ubuntu kinetic/test amd64 Packages docker-ce | 5:24.0.3-1~ubuntu.22.10~kinetic | https://download.docker.com/linux/ubuntu kinetic/stable amd64 Packages ...
|
Installing the newest version
1 2
| curl -fsSL https://test.docker.com -o test-docker.sh sudo sh test-docker.sh
|
Installing a version listed in the version list
1 2
| sudo apt-get install docker-ce=5:20.10.7~3-0~ubuntu-xenial
|
Installing a version not listed(older) in the version list
Conveniently install older versions by using Metarget .
After installing metarget and dependencies:
1 2
| ./metarget gadget install docker --version 18.03.1
|
Reference