3. 安装Docker(鲁班猫系统)

本章讲解如何在鲁班猫板卡上运行Docker。

3.1. 使用已安装Docker的镜像

为了方便使用,鲁班猫系统提供了一个安装了常用软件的镜像,如Python、Docker等软件, 直接给板卡烧录该镜像即可直接使用Docker,推荐大家直接使用这种方式。

镜像下载地址:敬请期待

镜像的烧录说明:敬请期待

3.2. 手动安装

直接参考Docker官方的安装说明文档,该文档包含了三种安装方式:

https://docs.docker.com/engine/install/debian/#install-using-the-convenience-script

建议直接用最后一种脚本安装的方法,且脚本运行时使用 Aliyun 参数可以通过阿里云镜像加速安装:

# 在板卡上执行如下命令,需要联网,耐心等待
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun

3.3. 测试

安装完成后,即可运行docker官方的hello-world示例:

# 在板卡上执行如下命令
sudo docker run hello-world

以下为docker的hello-world输出:

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/

提示

使用串口终端运行docker时,输出信息中可能会夹杂如下关于网络的提示信息, 一般不会影响具体的功能。若不想看到相关信息,可使用SSH终端来控制docker。

串口终端的一些网络提示
[   80.037473] IPv6: ADDRCONF(NETDEV_UP): vethf9ccc27: link is not ready
[   80.083292] IPv6: ADDRCONF(NETDEV_UP): vethd28eb42: link is not ready
[   80.090055] IPv6: ADDRCONF(NETDEV_CHANGE): vethd28eb42: link becomes ready
[   80.105263] IPv6: ADDRCONF(NETDEV_CHANGE): vethf9ccc27: link becomes ready
[   80.145431] docker0: port 1(vethd28eb42) entered blocking state
[   80.153137] docker0: port 1(vethd28eb42) entered disabled state
[   80.159764] device vethd28eb42 entered promiscuous mode
[   80.180674] docker0: port 1(vethd28eb42) entered blocking state
[   80.186625] docker0: port 1(vethd28eb42) entered forwarding state
[   80.222195] IPv6: ADDRCONF(NETDEV_CHANGE): docker0: link becomes ready
[   84.405990] docker0: port 1(vethd28eb42) entered disabled state
[   84.431545] eth0: renamed from vethf9ccc27
[   84.520012] docker0: port 1(vethd28eb42) entered blocking state
[   84.526059] docker0: port 1(vethd28eb42) entered forwarding state

3.4. 镜像加速

在后面使用Docker应用的时候,经常需要从Dockerhub网站下载大量的资源,但Dockerhub在国内的访问速度不快, 可参考如下网页说明设置国内镜像源进行加速:《Dockerhub镜像加速器》