目录
1--更新软件包索引
sudo apt update
2--配置依赖
① 安装依赖软件
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
② 导入源仓库的GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
③ 添加Docker API软件源到系统
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
3--安装Docker
① 安装
sudo apt install docker-ce docker-ce-cli containerd.io
② 验证
查看Docker的状态
sudo systemctl status docker
查看Docker版本
docker -v
启动和关闭Docker
systemctl start docker
systemctl stop docker