其实官网已经有详细的安装教程了,我这里就简单的翻译一下,原版:Install Docker Engine on Ubuntu | Docker Documentation
# 删除旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
# 更新以及安装必要依赖
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
# 添加秘钥
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# 添加仓库
echo \
"deb [arch=arm64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 开始安装
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
# 验证一下是否安装成功
ubuntu@ubuntu:/usr/local/redis$ docker -v
Docker version 20.10.6, build 370c289
出现下面这个说明安装成功