mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-11 04:14:38 +00:00
Fix errors
This commit is contained in:
@@ -31,9 +31,8 @@ $ sudo apt-get install \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg2 \
|
||||
lsb-release \
|
||||
software-properties-common
|
||||
gnupg \
|
||||
lsb-release
|
||||
```
|
||||
|
||||
鉴于国内网络问题,强烈建议使用国内源,官方源请在注释中查看。
|
||||
@@ -41,12 +40,16 @@ $ sudo apt-get install \
|
||||
为了确认所下载软件包的合法性,需要添加软件源的 GPG 密钥。
|
||||
|
||||
```bash
|
||||
$ curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/raspbian/gpg | sudo apt-key add -
|
||||
$ sudo install -m 0755 -d /etc/apt/keyrings
|
||||
$ curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/raspbian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
$ sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
|
||||
|
||||
## 官方源
|
||||
|
||||
## $ curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo apt-key add -
|
||||
## $ sudo install -m 0755 -d /etc/apt/keyrings
|
||||
## $ curl -fsSL https://download.docker.com/linux/raspbian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
## $ sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
|
||||
|
||||
```
|
||||
@@ -54,21 +57,16 @@ $ curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/raspbian/gpg | sudo apt-
|
||||
然后,我们需要向 `sources.list` 中添加 Docker 软件源:
|
||||
|
||||
```bash
|
||||
$ sudo add-apt-repository \
|
||||
"deb [arch=armhf] https://mirrors.aliyun.com/docker-ce/linux/raspbian \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
$ echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/raspbian \
|
||||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
|
||||
## 官方源
|
||||
|
||||
## $ sudo add-apt-repository \
|
||||
|
||||
## "deb [arch=armhf] https://download.docker.com/linux/raspbian \
|
||||
|
||||
## $(lsb_release -cs) \
|
||||
|
||||
## stable"
|
||||
## $ echo \
|
||||
## "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/raspbian \
|
||||
## $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
|
||||
```
|
||||
@@ -77,7 +75,7 @@ $ sudo add-apt-repository \
|
||||
|
||||
#### 报错解决办法
|
||||
|
||||
在 `Raspberry Pi OS Bullseye/Bookworm` 中,添加 Docker 软件源的步骤可能会出现如下报错:
|
||||
在 `Raspberry Pi OS Bullseye/Bookworm` 中,如果你使用 `add-apt-repository` 添加源,可能会出现如下报错(推荐改用上面的 `tee` 方式来写入 `/etc/apt/sources.list.d/docker.list`,可避免此问题):
|
||||
|
||||
```bash
|
||||
Traceback (most recent call last):
|
||||
@@ -95,12 +93,12 @@ aptsources.distro.NoDistroTemplateException: Error: could not find a distributio
|
||||
通过以下命令手动添加镜像源到 `/etc/apt/sources.list` 文件中即可解决:
|
||||
|
||||
```bash
|
||||
$ sudo echo "deb [arch=armhf] https://mirrors.aliyun.com/docker-ce/linux/raspbian $(lsb_release -cs) stable" | sudo tee -a /etc/apt/sources.list
|
||||
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/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
|
||||
## $ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/raspbian $(lsb_release -cs) stable" | sudo tee -a /etc/apt/sources.list
|
||||
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user