先直接上操作步骤:
- sudo apt update
- sudo apt 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 update
- sudo apt-cache policy docker.io (查看docker.io 中可使用的版本)
- sudo apt install docker.io=20.10.12-0ubuntu2~20.04.1(指定我们要使用的版本)
下载完成
启动:systemctl start docker
添加当前用户到docker组
sudo usermod -aG docker $USER
这样就不用每次都要sudo了,
还有一种方式:
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
apt-get update
apt-get install docker-ce=《version》 docker-ce-cli=《Version》