Essentially a clone of the official Node-RED image, but with a base image of lsiobase/alpine. This lets us make docker-mods like this one that adds the Home Assistant related add-ons to Node-RED
To run in Docker in its simplest form just run:
docker run -it -p 1880:1880 -v node_red_data:/config --name mynodered stecky/node-red
Let's dissect that command:
docker run - run this container, initially building locally if necessary
-it - attach a terminal session so we can see what is going on
-p 1880:1880 - connect local port 1880 to the exposed internal port 1880
-v node_red_data:/config - mount the host node_red_data directory to the container /config directory so any changes made to flows are persisted
--name mynodered - give this machine a friendly local name
stecky/node-red - the image to base it on - currently Node-RED v1.1.3
Running that command should give a terminal window with a running instance of Node-RED.
Welcome to Node-RED
===================
10 Jul 12:57:10 - [info] Node-RED version: v1.1.3
10 Jul 12:57:10 - [info] Node.js version: v10.21.0
10 Jul 12:57:10 - [info] Linux 4.9.184-linuxkit x64 LE
10 Jul 12:57:11 - [info] Loading palette nodes
10 Jul 12:57:16 - [info] Settings file : /config/settings.js
10 Jul 12:57:16 - [info] Context store : 'default' [module=memory]
10 Jul 12:57:16 - [info] User directory : /config
10 Jul 12:57:16 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 Jul 12:57:16 - [info] Flows file : /config/flows.json
10 Jul 12:57:16 - [info] Creating new flow file
10 Jul 12:57:17 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
10 Jul 12:57:17 - [info] Starting flows
10 Jul 12:57:17 - [info] Started flows
10 Jul 12:57:17 - [info] Server now running at http://127.0.0.1:1880/
[...]
You can then browse to http://{host-ip}:1880
to get the familiar Node-RED desktop.
The advantage of doing this is that by giving it a name (mynodered) we can manipulate it more easily, and by fixing the host port we know we are on familiar ground. Of course this does mean we can only run one instance at a time... but one step at a time folks...
If we are happy with what we see, we can detach the terminal with Ctrl-p
Ctrl-q
- the
container will keep running in the background.
To reattach to the terminal (to see logging) run:
docker attach mynodered
If you need to restart the container (e.g. after a reboot or restart of the Docker daemon):
docker start mynodered
and stop it again when required:
docker stop mynodered
Healthcheck: to turn off the Healthcheck add --no-healthcheck
to the run command.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the GNU General License - see the LICENSE file for details.