ubuntu系统docker安装
时间: 2024-02-20 14:55:21 浏览: 85
Ubuntu系统上安装Docker可以按照以下步骤进行:
1. 更新系统软件包:
```
sudo apt update
```
2. 安装必要的软件包,以便使用HTTPS来通过apt访问Docker仓库:
```
sudo apt install apt-transport-https ca-certificates curl software-properties-common
```
3. 添加Docker的官方GPG密钥:
```
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
```
4. 添加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
```
5. 更新软件包索引并安装Docker Engine:
```
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io
```
6. 验证Docker是否正确安装:
```
sudo docker run hello-world
```
如果一切顺利,你将看到一个简单的输出,表示Docker已经成功安装并运行。
阅读全文