docker 安装apt-get
时间: 2023-10-04 13:11:44 浏览: 157
docker的安装
Docker是一款容器化技术,不需要使用apt-get命令进行安装。Docker的安装方式与操作系统有关,可以在官方文档中找到对应的安装说明。以下是在Ubuntu操作系统上安装Docker的步骤:
1. 更新apt-get软件包列表:
```
sudo apt-get update
```
2. 安装Docker依赖的软件包:
```
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
```
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官方APT源:
```
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. 更新apt-get软件包列表:
```
sudo apt-get update
```
6. 安装Docker:
```
sudo apt-get install docker-ce docker-ce-cli containerd.io
```
7. 验证Docker是否安装成功:
```
sudo docker run hello-world
```
如果输出类似以下信息,则表示Docker安装成功:
```
Hello from Docker!
This message shows that your installation appears to be working correctly.
```
阅读全文