从零开始,搭建边缘计算服务并配置 Docker:只需三步(ARM平台)

伊始
随着边缘计算的发展,将Docker技术应用于边缘设备或节点上,可以更好地处理和分析实时数据。尤其是低功率的设备(RK3288 在5W左右)通过在边缘设备上运行Docker容器,可以减少数据传输延迟,提高数据处理效率,并增强系统的可扩展性和可靠性。因此,在Ubuntu 16上安装和配置Docker,不仅可以在本地环境进行应用程序开发和测试,还可以为边缘计算提供强大的支持。比如搭建NAS,做流媒体服务器等。
本次给各位演示如何在RK3288设备上如何安装docker
全文1500字,阅读预计3-10分钟

一、初始设置
处理器架构: Arm armRK3288
内存闪存: 4G + 16G
操作系统: Ubuntu 16 (内核4.4)
Docer 17.09.1-ce
注意: 由于Ubuntu的内核版本是4.4,对应的Docker版本为16~18。因此,我们下载的是docker-17.09.1-ce.tgz。如果内核版本过低,需要使用较低版本的Docker。

二、环境更新
1、更新环境
运行
sudo apt-get update更新系统。执行
sudo apt-get upgrade更新所有的已安装包。安装必要的依赖:

更新会有一会,然后执行
安装相关依赖
运行
sudo apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common
2、下载和安装Docker
执行命令:
wget https://download.docker.com/linux/static/stable/armhf/docker-17.06.0-ce.tgz

解压缩
运行命令
tar -xvf docker-17.06.0-ce.tgz

测试版本是否对应
运行命令
sudo docker version

3、这里程序是可以运行的,现在制作系统启动项
运行命令
sudo cp ./docker/* /usr/bin/

制作docker.server启动文件:
编辑docker文件
sudo vim /lib/systemd/system/docker.servcie
复制以下内容
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd --exec-opt native.cgroupdriver=systemd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3
# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
OOMScoreAdjust=-500
[Install]
WantedBy=multi-user.target
测试是否成功
运行以下命令
sudo systemctl restart docker && sudo systemctl status docker

可以看到成功启动了。
4、加入开机启动项
执行命令
systemctl enable docker.service
设置为开机启动。完成部署
总结
由于docker和linxu内核的兼容性问题,不是最新的docker就能运行,所以在适配docker版本时,尽量不用最新的。或者有可能升级一下系统内核(估计够呛~)
其他相关推荐
作者声明本文无利益相关,欢迎值友理性交流,和谐讨论~
