ubantu23.04安装docker
时间: 2023-08-08 22:05:13 浏览: 294
要在Ubuntu 23.04上安装Docker,可以按照以下步骤进行操作:
1. 首先,删除旧版本的Docker(如果有的话):
```
sudo apt-get remove docker docker-engine docker.io containerd runc
```
2. 更新apt软件包索引并安装必要的软件包以允许apt通过HTTPS使用存储库:
```
sudo apt-get update -y
sudo apt-get install -y \
ca-certificates \
curl \
gnupg
```
3. 添加Docker的GPG密钥:
```
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
```
4. 添加Docker的稳定版仓库:
```
echo \
"deb \[arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg\] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo \"$VERSION_CODENAME\") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
5. 更新apt软件包索引并安装Docker:
```
sudo apt-get -y update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
```
6. 将当前用户添加到docker用户组中(可选):
```
sudo usermod -a -G docker <username>
```
请注意,上述步骤是基于Ubuntu 23.04的安装过程。确保您的系统版本正确,并根据需要进行调整。另外,如果您需要安装Docker Compose,可以使用以下命令:
```
sudo curl -L https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
```
\[1\]\[2\]\[3\]
#### 引用[.reference_title]
- *1* [Ubuntu 23.04 安装 Harbor](https://blog.csdn.net/engchina/article/details/130413746)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [在Ubuntu中安装Docker和docker的使用](https://blog.csdn.net/qq_41985134/article/details/120653645)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文