debian子系统安装docker
时间: 2024-07-27 15:01:11 浏览: 152
在Debian子系统上安装Docker,通常需要几个步骤。由于Debian支持多种版本,如基于Linux内核的Debian、Ubuntu等,这里将以基于Debian的容器镜像(例如Debian Bullseye)为例:
1. **更新包列表**:
```
sudo apt update
```
2. **安装依赖库**:
```
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-fsSL https://download.docker.com/linux/debian/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/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
5. **再次更新并安装Docker**:
```
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
```
6. **启动和启用Docker服务**:
```
sudo systemctl start docker
sudo systemctl enable docker
```
7. **验证安装**:
最后运行 `sudo docker run hello-world` 来检查Docker是否安装成功。
阅读全文