1. sudo apt update #更新本地的包索引。

  2. sudo apt upgrade -y #升级已安装的软件包。

  3. lsb_release -a #查看操作系统的版本信息。

  4. sudo apt install apt-transport-https ca-certificates curl software-properties-common #安装一些必需的工具和软件包。

  5. wget  https://download.docker.com/linux/ubuntu/gpg #下载 Docker 的 GPG 公钥。

  6. sudo apt-key add gpg #将下载的 GPG 公钥添加到系统的 APT 密钥环中。

  7. sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" #将 Docker 官方的 APT 仓库添加到系统的软件源中,使用阿里云的镜像源。

  8. sudo apt install docker-ce #安装 Docker Community Edition(CE)。

  9. sudo systemctl status docker #检查 Docker 服务的状态。