ubuntu24 安装docker
时间: 2024-09-28 08:02:47 浏览: 91
Ubuntu 24.04安装Docker的步骤如下:
1. 更新系统包列表:
```
sudo apt update
```
2. 安装依赖软件包,包括apt-transport-https和ca-certificates:
```
sudo apt install apt-transport-https ca-certificates curl software-properties-common 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以应用新的配置:
```
sudo apt-get update
```
6. 安装Docker:
```
sudo apt install docker-ce docker-ce-cli containerd.io
```
7. 验证安装完成:
```
sudo docker run hello-world
```
8. 启动并设置为开机启动:
```
sudo systemctl start docker
sudo systemctl enable docker
```
阅读全文