1.更新软件包
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
2.设置GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3.添加Docker APT 软件源
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
4.安装docker
(1)最新版本
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
(2)指定版本
sudo apt update
apt list -a docker-ce
# VERSION 替换成版本
sudo apt install docker-ce=<VERSION> docker-ce-cli=<VERSION> containerd.io
5.docker版本查看
docker -v