调试记录-Raspi安装docker

向 source.list 中添加 Docker CE 软件源,操作报错,信息如下:

pi@raspi:~ $ sudo add-apt-repository "deb [arch=armhf] https://mirrors.ustc.edu.
$(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"
    self.reload_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py"
    self.distro.get_sources(self.sourceslist)
  File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_so
    (self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distributio

使用手册中的命令,添加源列表不成功,报错信息:

aptsources.distro.NoDistroTemplateException: Error: could not find a distributio

然后通过直接打开source.list,直接添加。

pi@raspi:~ $ sudo vi /etc/apt/sources.list

添加的内容如下:

deb https://download.docker.com/linux/raspbian stretch stable

执行安装命令,可以正确安装docker

pi@raspi:~ $ sudo apt-get install docker-ce
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会同时安装下列软件:
  cgroupfs-mount containerd.io docker-ce-cli pigz
下列【新】软件包将被安装:
  cgroupfs-mount containerd.io docker-ce docker-ce-cli pigz
升级了 0 个软件包,新安装了 5 个软件包,要卸载 0 个软件包,有 229 个软件包未被升级。
需要下载 57.7 MB 的归档。
解压缩后会消耗 255 MB 的额外空间。
您希望继续执行吗? [Y/n]

退出当前终端并重新登录, 进行如下测试,验证docker是否安装成功。
注:一定要退出终端再重新登录

pi@raspi:~ $ sudo docker run arm32v7/hello-world
Unable to find image 'arm32v7/hello-world:latest' locally
latest: Pulling from arm32v7/hello-world
4ee5c797bcd7: Pull complete
Digest: sha256:d32a4c07ce3055032a8d2d59f49ca55fafc54a4e840483b590f7565769dc7e00
Status: Downloaded newer image for arm32v7/hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (arm32v7)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

你可能感兴趣的:(linux)