Dockerize Node-RED

Node Red Screenshot

Keen to mess around with Node-RED? Or you want to deploy node-red to your own docker server or Dokku and add some additional nodes?

The following solution consists of two files:

  • A Dockerfile to build the container (3 Lines)
  • A package.json to configure the version and some useful add-on nodes

 

The Dockerfile

The build is derived from an official node container (version 0.10.x).

The configuration

The used version and the additional node are configured in the package.json. In my example below, version 0.12.1 of node-red will be installed. If you want to add other/additional nodes, just edit the dependencies block and add them.

The build

build nodered terminalTo build this image just put both files in one directory and run

docker build --rm -t node-red .

 

 

 

The start

to start your new container, just run the following command. This will bind the port 1880 to your local machine and also mount a local directory as storage for the configuration and the flows (/opt/node-red-datastore would be the directory on your docker host).

docker run -it -p 1880:1880 -v /opt/node-red-datastore:/root/.node-red node-red

Now you should be able to connect to the node red instance by opening http://<yourhost>:1880 in your browser.

Links