Ubuntu22.04 安装docker
时间: 2024-11-04 19:09:30 浏览: 20
要在Ubuntu 22.04系统上安装Docker,你可以按照以下步骤操作:
1. **更新系统**:
```
sudo apt update && sudo apt upgrade
```
2. **安装依赖**:
```
sudo apt 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 sources**:
```
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. **再次更新源并安装Docker**:
```
sudo apt update
sudo apt 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。现在可以通过`docker`命令行工具开始使用它了。
阅读全文