每当通过docker启动Node-red服务器时如何加载特定流?

时间:2019-01-09 06:57:40

标签: docker docker-compose node-red

我正在通过docker-compose运行Node-red服务器,并且每次执行“ docker-compose up”都会创建新的流。如何防止这种情况发生?以及如何加载/导入特定的流而不是新的流,因为每次将节点复制到新流时都很忙?谢谢!

nodered_1        | 9 Jan 05:32:55 - [warn] ------------------------------------------------------
nodered_1        | 9 Jan 05:32:55 - [warn] [node-red/rpi-gpio] Info : Ignoring Raspberry Pi specific node
nodered_1        | 9 Jan 05:32:55 - [warn] ------------------------------------------------------
nodered_1        | 9 Jan 05:32:55 - [info] Settings file  : /var/node-red/settings.js
nodered_1        | 9 Jan 05:32:55 - [info] User directory : /var/node-red
nodered_1        | 9 Jan 05:32:55 - [info] Flows file     : /var/node-red/flows_dc4a44db1d02.json
nodered_1        | 9 Jan 05:32:55 - [info] Creating new flow file
nodered_1        | 9 Jan 05:32:55 - [info] Starting flows
nodered_1        | 9 Jan 05:32:55 - [info] Started flows
nodered_1        | 9 Jan 05:32:55 - [info] Server now running at http://127.0.0.1:1880/

1 个答案:

答案 0 :(得分:1)

您需要传递要使用的流的名称,有关如何执行此操作的说明,请参见README中的Node-RED docker映像:

  

$ docker run -it -p 1880:1880 -e FLOWS=my_flows.json nodered/node-red-docker

您还需要安装自己的数据目录,以使流程在创建的新实例之间持久存在,同样位于自述文件here

  

$ docker run -it -p 1880:1880 -v ~/.node-red:/data --name mynodered nodered/node-red-docker

因此将2结合起来可以得到:

$ docker run -it -p 1880:1880 -e FLOWS=my_flow.json -v ~/.node-red:/data --name mynodered nodered/node-red-docker

您将必须使用该命令行并将其映射到docker-compose文件中。