目 录
1. 概述... 2
2. 演示信息... 2
3. 安装Docker容器... 2
4. 安装dotnet镜像... 3
5. 复制iNeuKernel到容器中... 4
6. 进入指定容器... 4
7. 安装dotnet框架... 4
8. 在Docker容器中运行iNeuKernel物联网框架... 5
1. 概述
最近有客户需求:把iNeuOS部署在Docker下。以前实践过部署在Linux的Ubuntu和树莓派中。参见:https://www.cnblogs.com/lsjwq/p/11655093.html,https://www.cnblogs.com/lsjwq/p/11716909.html
这次我们实践了把物联网核心组件iNeuKernel部署在了Docker容器下,实践证明.NETCore支持云原生方面表现的很好。
今天就放假了,放了15天。最后一天,发一篇文章。
iNeuOS在线演示:http://demo.ineuos.net (注:服务器比较慢,请耐心等待。自已注册用户,体验系统功能)
视频演示:http://www.ineuos.net/video/iNeuOS%20and%20app.mp4
驱动开发:http://www.ineuos.net/index.php/products/ineukernel-15.html (v2.1版本)
手机APP:http://demo.ineuos.net/app/ineuos_app.apk
(1)Update the apt
package index:
$ sudo apt-get update
(2)Install packages to allow apt
to use a repository over HTTPS:
$ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common
(3)Add Docker’s official GPG key:
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
(4)Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
, by searching for the last 8 characters of the fingerprint.
$ sudo apt-key fingerprint 0EBFCD88
(5)Use the following command to set up the stable repository. To add the nightly or test repository
$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"
(6)Update the apt
package index:
$ sudo apt-get update
(7)Install the latest version of Docker Engine - Community and containerd:
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
(8)Verify that Docker Engine - Community is installed correctly by running the hello-world
image.
sudo docker run hello-world
(1)在Docker容器中获取dotnet镜像
$ sudo docker pull microsoft/dotnet
(2)查看当前已有的docker镜像文件
$ sudo docker images
(3)开始新建并运行一个以dotnet镜像的容器
$ sudo docker run -it microsoft/dotnet
(4)退出当前容器
$ exit
(5)查看当前container id:
$ sudo docker ps –a
如下图:
从宿主机中复制文件到容器中:
$ sudo docker cp /home/developer/work/ iNeuKernelCore-linux-2.2/ 88a36edba257:/opt
注:88a36edba257 为容器的ID。
(1)启动容器:
$ sudo docker start 88a36edba257
(2)进入容器:
$ sudo docker attach 88a36edba257
注:其他容器命令,请搜索。
$ wget -q https://packages.microsoft.com/config/ubuntu/19.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb $ sudo dpkg -i packages-microsoft-prod.deb $sudo apt-get update $sudo apt-get install apt-transport-https $sudo apt-get update $sudo apt-get install dotnet-sdk-2.2
注:官网有详细教程。
在相应的目录下运行:
root@88a36edba257:/# cd /opt/ iNeuKernelCore-linux-2.2 root@88a36edba257:/# dotnet iNeuKernel.Host.Core.dll
运行效果如下图:
注:可以打包成镜像,托管到第三方平台,以后使用直接拉取到本地(docker pull)。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。