Docker官方安装文档

卸载旧版本

1
sudo apt-get remove docker docker-engine docker.io containerd runc

更新数据源

1
sudo apt-get update

安装必备依赖

1
sudo apt-get install -y ca-certificates curl gnupg lsb-release

安装GPG证书

1
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

添加稳定数据源

1
2
3
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

更新数据源

1
sudo apt-get update

安装最新版本

1
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

验证安装

1
sudo docker --version

查看信息

1
sudo docker info