Fix and update

This commit is contained in:
baohua
2026-02-09 11:34:35 -08:00
parent e669ee0fe8
commit 63377d0431
136 changed files with 2146 additions and 262 deletions

View File

@@ -1,9 +1,15 @@
## 树莓派卡片电脑安装 Docker
## 树莓派卡片电脑安装 Docker
树莓派等 ARM 架构设备在物联网和边缘计算领域应用广泛本节介绍如何在树莓派上安装 Docker
>警告切勿在没有配置 Docker APT 源的情况下直接使用 apt 命令安装 Docker.
### 系统要求
Docker ARM 架构有着良好的支持
Docker 不仅支持 `x86_64` 架构的计算机同时也支持 `ARM` 架构的计算机本小节内容以树莓派单片电脑为例讲解 `ARM` 架构安装 Docker
Docker 支持以下版本的 [Raspberry Pi OS](https://www.raspberrypi.org/software/operating-systems/) 操作系统:
@@ -16,6 +22,8 @@ Docker 支持以下版本的 [Raspberry Pi OS](https://www.raspberrypi.org/softw
### 使用 APT 安装
推荐使用 APT 包管理器进行安装以确保版本的稳定性和安全性
由于 apt 源使用 HTTPS 以确保软件下载过程中不被篡改因此我们首先需要添加使用 HTTPS 传输的软件包以及 CA 证书
```bash
@@ -39,7 +47,10 @@ $ curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/raspbian/gpg | sudo apt-
## 官方源
## $ curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo apt-key add -
```
然后我们需要向 `sources.list` 中添加 Docker 软件源
@@ -52,15 +63,21 @@ $ sudo add-apt-repository \
## 官方源
## $ sudo add-apt-repository \
## "deb [arch=armhf] https://download.docker.com/linux/raspbian \
## $(lsb_release -cs) \
## $lsb_release -cs \
## stable"
```
>以上命令会添加稳定版本的 Docker APT 如果需要测试版本的 Docker 请将 stable 改为 test
##### 报错解决办法
#### 报错解决办法
`Raspberry Pi OS Bullseye/Bookworm` 添加 Docker 软件源的步骤可能会出现如下报错:
@@ -84,7 +101,10 @@ $ sudo echo "deb [arch=armhf] https://mirrors.aliyun.com/docker-ce/linux/raspbia
## 官方源
## $ sudo echo "deb [arch=armhf] https://download.docker.com/linux/raspbian $(lsb_release -cs) stable" | sudo tee -a /etc/apt/sources.list
## $ sudo echo "deb [arch=armhf] https://download.docker.com/linux/raspbian $lsb_release -cs stable" | sudo tee -a /etc/apt/sources.list
```
#### 安装 Docker
@@ -105,15 +125,20 @@ $ sudo apt-get install docker-ce
```bash
## $ curl -fsSL test.docker.com -o get-docker.sh
$ curl -fsSL get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh --mirror Aliyun
## $ sudo sh get-docker.sh --mirror AzureChinaCloud
```
执行这个命令后脚本就会自动的将一切准备工作做好并且把 Docker 的稳定(stable)版本安装在系统中
### 启动 Docker
运行以下命令
```bash
$ sudo systemctl enable docker
$ sudo systemctl start docker
@@ -139,6 +164,8 @@ $ sudo usermod -aG docker $USER
### 测试 Docker 是否安装正确
运行以下命令
```bash
$ docker run --rm hello-world