sudo add-apt-repository \
“deb [arch=armhf] https://download.docker.com/linux/raspbian
$(lsb_release -cs)
stable”
Traceback (most recent call last):
File “/usr/bin/add-apt-repository”, line 95, in
sp = SoftwareProperties(options=options)
File “/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py”, line 103, in init
self.sourceslist = SourcesList()
File “/usr/lib/python3/dist-packages/aptsources/sourceslist.py”, line 273, in init
self.matcher = SourceEntryMatcher(matcherPath)
File “/usr/lib/python3/dist-packages/aptsources/sourceslist.py”, line 457, in init
dist = DistInfo(f, base_dir=matcherPath)
File “/usr/lib/python3/dist-packages/aptsources/distinfo.py”, line 254, in init
template.description = _(value)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xb0 in position 0: invalid start byte
要手动添加 Docker 仓库到你的树莓派的 /etc/apt/sources.list 文件,你可以按照以下步骤操作:
打开终端:首先,打开你的树莓派上的终端。
编辑 sources.list 文件:
使用 nano 或 vim 编辑器打开 /etc/apt/sources.list 文件。如果你更喜欢 nano,可以使用以下命令:
bash
Copy code
sudo nano /etc/apt/sources.list
如果你更熟悉 vim,使用以下命令:
bash
Copy code
sudo vim /etc/apt/sources.list
添加 Docker 仓库:
在文件的末尾添加以下行:
bash
Copy code
deb [arch=armhf] https://download.docker.com/linux/raspbian
(
l
s
b
r
e
l
e
a
s
e
−
c
s
)
s
t
a
b
l
e
这里,
(lsb_release -cs) stable 这里,
(lsbrelease−cs)stable这里,(lsb_release -cs) 会自动替换为你的树莓派操作系统的代号。如果你遇到问题,可以手动替换这部分为你的操作系统版本(如 buster、stretch 等)。
保存并关闭文件:
如果你在使用 nano,按下 Ctrl + X,然后按 Y 确认保存更改,最后按 Enter 键退出。
如果你在使用 vim,按 :wq 然后按 Enter 保存并退出。
更新软件源列表:
在终端中运行以下命令来更新你的软件源列表:
bash
Copy code
sudo apt-get update
完成这些步骤后,Docker 仓库就被添加到你的树莓派中了。这应该会解决你在使用 add-apt-repository 命令时遇到的问题。接下来,你可以继续安装 Docker 或进行其他操作。