资讯专栏INFORMATION COLUMN

Deploy NodeJS with node-red, mongodb, dashboard in

cgh1999520 / 389人阅读

摘要:

Docker File

Create this file with the name Dockerfile and put into your project root folder.

# specify the node base image with your desired version node:
FROM node:8

WORKDIR /app

RUN chown -R node:node /usr/local/lib/node_modules
RUN chown -R node:node /usr/local/bin
USER node

RUN npm install node-red -g
RUN npm install node-red-node-mongodb -g
RUN npm i node-red/node-red-dashboard -g

# port 1880 for node-red-dashboard
EXPOSE 1880

CMD node-red
Important in the Docker File

You need to include the -g behind, as if you don"t the package won"t be installed.

RUN npm install node-red -g
RUN npm install node-red-node-mongodb -g
RUN npm i node-red/node-red-dashboard -g

However, there will be permission error if you just do that. So you need to change the owner and switch the user before that.

RUN chown -R node:node /usr/local/lib/node_modules
RUN chown -R node:node /usr/local/bin
USER node
The Joy

Then you can build using docker build -t nodejs .
After running the docker image using docker run -it -p 1880:1880 nodejs
You can now access the node-red in your browser.
Btw, you could map multiple ports from the container to host by using multiple -p option.

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/26998.html

相关文章

  • Deploy NodeJS with node-red, mongodb, dashboard in

    摘要: Docker File Create this file with the name Dockerfile and put into your project root folder. # specify the node base image with your desired version node: FROM node:8 WORKDIR /app RUN chown -...

    iKcamp 评论0 收藏0
  • Deploy NodeJS Docker to QiO Edge Cloud using Kuber

    Create App and build docker image Create a file of the name Dockerfile with the content below and put into your project root folder. # specify the node base image with your desired version node: FROM ...

    W4n9Hu1 评论0 收藏0
  • Deploy NodeJS Docker to QiO Edge Cloud using Kuber

    Create App and build docker image Create a file of the name Dockerfile with the content below and put into your project root folder. # specify the node base image with your desired version node: FROM ...

    lentoo 评论0 收藏0
  • parse-server和parse-dashboard安装及阿里云express部署

    摘要:一参考资源网址官网资源站资源站页国内用户文章二开始部署基础环境安装等。安装官网下载安装即可。到安装目的的文件夹运行启动服务。修改结果如下说明是的数据库地址,请确保该地址正确。解决办法是将导入的数据重新导出或,将会获得包含的数据。 一、参考资源网址1、http://parseplatform.org/#server 官网2、https://github.com/parse-comm......

    pcChao 评论0 收藏0
  • IoT实时数据可视化方案(进阶版):Worldmap Panel使用详解及使用Node-RED进行流

    摘要:权衡性价比之后,决定采取最后一种方案。它们分别用于处理流入结点之前的数据,和结点之后的数据。这时对数据库进行简单的操作检查数据是否如自己预期地被写入了指定数据库。 Chap.1 万万没想到,我这一世英名葬送在了地图坑里 继上次搭建完框架得到了个粗糙的demo以后,基本的图形组件试了个遍没什么阻力。我天真地以为我离真理的距离简直就只有一步之遥了。  想着我还有些模拟的地理数据没有做可视化...

    qingshanli1988 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<