以下是在 Ubuntu 上安装 Docker 的步骤指南:
- 更新现有软件包列表:
sudo apt-get update
- 安装允许 apt 通过 HTTPS 使用存储库的软件包:
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
- 添加 Docker 官方 GPG 密钥:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- 验证密钥的指纹:
sudo apt-key fingerprint 0EBFCD88
- 设置 Docker 存储库:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- 更新 apt 软件包索引:
sudo apt-get update
- 安装最新版本的 Docker Engine – Community 和 containerd:
sudo apt-get install docker-ce docker-ce-cli containerd.io
- 通过运行 hello-world 镜像来验证 Docker 是否正确安装:
sudo docker run hello-world
注意:上述步骤适用于 Ubuntu 20.04 及更高版本。安装步骤可能因 Ubuntu 版本而异。
作者:牛奇网,本站文章均为辛苦原创,在此严正声明,本站内容严禁采集转载,面斥不雅请好自为之,本文网址:https://www.niuqi360.com/linux/how-to-install-docker-on-ubuntu-20-04-2/