You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The barest minimum we need to just run Node-RED is
236
-
237
-
$ docker run -d -p 1880 --name mynodered nodered/node-red
238
-
239
-
This will create a local running instance of a machine - that will have some
240
-
docker id number and be running on a random port... to find out run
241
-
242
-
$ docker ps
243
-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
244
-
dd78e5bab6c4 nodered/node-red "npm start -- --user…" 7 seconds ago Up 5 seconds 0.0.0.0:32768->1880/tcp charming_chatterjee
245
-
$
246
-
247
-
You can now point a browser to the host machine on the tcp port reported back, so in the example
248
-
above browse to `http://{host ip}:32768`
243
+
To run headless, (i.e. in the background), just replace the `-it` in most previous commands
244
+
with `-d`, for example:
245
+
```
246
+
docker run -d -p 1880:1880 --name mynodered nodered/node-red
247
+
```
249
248
250
249
### Container Shell
251
250
252
251
Once it is running headless you can use the following command to get access back into the container.
253
252
```
254
253
$ docker exec -it mynodered /bin/bash
254
+
bash-4.4$
255
255
```
256
256
257
257
Will give a command line inside the container - where you can then run the npm install
258
-
command you wish - e.g.
258
+
command you wish - for example
259
259
```
260
260
bash-4.4$ npm install node-red-dashboard
261
261
bash-4.4$ exit
262
262
$ docker stop mynodered
263
263
$ docker start mynodered
264
264
```
265
265
266
-
Refreshing the browser page should now reveal the newly added node in the palette.
266
+
Refreshing the browser page should now reveal the newly added nodes in the palette.
267
+
268
+
### Multiple Instances
269
+
270
+
Running
271
+
```
272
+
docker run -d -p 1880 nodered/node-red
273
+
```
274
+
will create a local running instance of a machine. Note: we did not specify a name.
275
+
276
+
This container will have an id number and be running on a random port... to find out which port, run `docker ps`
277
+
```
278
+
$ docker ps
279
+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
280
+
860258cab092 nodered/node-red "npm start -- --user…" 10 seconds ago Up 9 seconds 0.0.0.0:32768->1880/tcp dazzling_euler
281
+
```
282
+
283
+
You can now point a browser to the host machine on the tcp port reported back, so in the example
284
+
above browse to `http://{host ip}:32768`
267
285
268
286
### Linking Containers
269
287
270
288
You can link containers "internally" within the docker runtime by using the --link option.
271
289
272
290
For example I have a simple MQTT broker container available as
273
291
274
-
docker run -it --name mybroker eclipse-mosquitto
292
+
docker run -it --name mybroker eclipse-mosquitto
275
293
276
294
(no need to expose the port 1883 globally unless you want to... as we do magic below)
277
295
278
296
Then run nodered docker - but this time with a link parameter (name:alias)
279
297
280
-
docker run -it -p 1880:1880 --name mynodered --link mybroker:broker nodered/node-red
298
+
docker run -it -p 1880:1880 --name mynodered --link mybroker:broker nodered/node-red
281
299
282
300
the magic here being the `--link` that inserts a entry into the node-red instance
283
301
hosts file called *broker* that links to the external mybroker instance.... but we do
@@ -291,6 +309,7 @@ This way the internal broker is not exposed outside of the docker host - of cour
291
309
you may add `-p 1883:1883` etc to the broker run command if you want to see it...
292
310
293
311
### Raspberry PI - native GPIO support
312
+
294
313
| v1.0 - BREAKING: Native GPIO support for Raspberry PI has been dropped |
295
314
| --- |
296
315
The replacement for native GPIO is [node-red-node-pi-gpiod](https://github.com/node-red/node-red-nodes/tree/master/hardware/pigpiod).
@@ -311,6 +330,13 @@ Disadvantages of the native GPIO support are:
311
330
312
331
**Note**: There is a contributed [gpiod project](https://github.com/corbosman/node-red-gpiod) that runs the gpiod in its own container rather than on the host if required.
313
332
333
+
### Serial Port - Dialout - Adding Groups
334
+
335
+
To access the host serial port you may need to add the container to the `dialout` group. This can be enabled by adding `--group-add dialout` to the start command. For example
336
+
```
337
+
docker run -it -p 1880:1880 --group-add dialout --name mynodered nodered/node-red
0 commit comments