ubuntu 22.04docker安装方法
时间: 2024-08-12 10:06:34 浏览: 202
Ubuntu 22.04系统上安装Docker的步骤如下:
1. **更新包列表**:
```bash
sudo apt update
```
2. **添加Docker GPG密钥**:
```
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
```
3. **添加Docker仓库**:
```bash
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
```
4. **安装依赖**:
```bash
sudo apt-get install apt-transport-https ca-certificates
```
5. **安装Docker**:
```bash
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
```
6. **启动并设置为开机自启**:
```bash
sudo systemctl start docker
sudo systemctl enable docker
```
7. **验证安装**:
运行 `sudo docker run hello-world` 来确认Docker是否成功安装。
阅读全文