apt update
apt install apt-transport-https ca-certificates curl software-properties-common
添加 Docker 官方的 GPG 密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
添加 Docker 官方的存储库:
echo "deb [arch=amd64 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
更新软件包列表,以使 Docker 存储库可用:
apt update
安装 Docker 引擎:
sudo apt install docker-ce docker-ce-cli containerd.io
验证 Docker 是否正确安装,运行一个 Docker 镜像(如 Ubuntu):
docker run hello-world