Ubuntu安装docker
时间: 2023-11-05 09:56:22 浏览: 37
以下在 Ubuntu 系统中安装 Docker 的步骤:
1. 更新软件包列表:
```
sudo apt-get update
```
2. 安装必要的依赖项:
```
sudo apt-get install apt-transport-https ca-certificates curl 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:
```
sudo apt-get install docker-ce
```
7. 启动 Docker 服务:
```
sudo systemctl start docker
```
8. 验证 Docker 是否安装成功:
```
sudo docker run hello-world
```
如果成功安装,将会输出一些信息,其中包括 "Hello from Docker!" 字样。
以上就是在 Ubuntu 中安装 Docker 的步骤。