sudo apt-get install docker-ce
时间: 2023-09-27 20:12:35 浏览: 62
这个命令是用来安装 Docker CE (Community Edition) 的,需要在 Ubuntu 系统中以管理员权限运行。Docker CE 是一个开源的容器化平台,可以让开发者快速构建、打包和发布应用程序。安装 Docker CE 可以执行以下步骤:
1. 打开终端,输入以下命令更新软件包索引:
```
sudo apt-get update
```
2. 安装 Docker CE 依赖的软件包:
```
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
```
3. 添加 Docker 的官方 GPG 密钥:
```
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
```
4. 添加 Docker 的官方 APT 软件源:
```
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
```
5. 更新软件包索引:
```
sudo apt-get update
```
6. 安装 Docker CE:
```
sudo apt-get install docker-ce
```
7. 安装完成后,可以通过运行以下命令验证 Docker 是否正确安装:
```
sudo docker run hello-world
```
如果一切正常,将输出 "Hello from Docker!" 的消息。