# Create node that runs a docker while node-red is also running in docker

**URL:** <https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659>\
**Category:** Developing Nodes\
**Tags:** docker\
**Created:** [2 September 2024 16:39 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659 "2024-09-02T16:39:00Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![seb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seb/32/94157_2.png) [@seb](https://discourse.nodered.org/u/seb)\
**Post date:** [2 September 2024 16:39 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/1 "2024-09-02T16:39:01Z")

</div>

Hello,

I’m running Node-RED in Docker (and it will be running in Kubernetes soon). I’d like to add custom nodes that are Docker containers themselves. For example, one node will be a local LLM, and another will have some heavy logic running in another Docker container, and so forth.

Any ideas?

Thanks.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [3 September 2024 06:18 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/2 "2024-09-03T06:18:07Z")

</div>

A local LLM within a node-red node ?  
I may not understand it correctly - but I would not recommend this: separation of concern.

Run a LLM in a container and expose it via some API.  
Call the API from node-red.

---

<div class="post-metadata">

**Author:** ![seb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seb/32/94157_2.png) [@seb](https://discourse.nodered.org/u/seb)\
**Post date:** [3 September 2024 14:41 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/3 "2024-09-03T14:41:19Z")

</div>

yes, you are right.

ok, I've used the wrong example. Imagine some heavy processing script written in python. Any way to wrap it inside a docker container that is then wrapped inside a node-red node so that I can use it in node-red ?.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [3 September 2024 14:50 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/4 "2024-09-03T14:50:10Z")

</div>

there is nothing stopping your node-red executing docker commands and spinning up containers.

Another way could be to have multiple node-reds running and offload work to them using simple MQTT comms as a control + command API.

keeping everything in Node-RED will give the visual benefits.

* * *

company hat on for a moment - most of what you are asking (like spinning up more nodes, docker/Kubernetes orchestration) has pretty much been solved by [FlowFuse](https://flowfuse.com/) (which is open source) - maybe worth checking it out?

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [3 September 2024 15:09 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/5 "2024-09-03T15:09:34Z")

</div>

a 'node' within node-red is a node js library which is wrapped as an npm package, which are javascript files that contain all the complexities and functionality. Docker is used for containers, something completely different.

> Imagine some heavy processing script written in python

I would do the 'heavy processing' in javascript, although you could call the python script from javascript.

---

<div class="post-metadata">

**Author:** ![seb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seb/32/94157_2.png) [@seb](https://discourse.nodered.org/u/seb)\
**Post date:** [3 September 2024 16:53 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/6 "2024-09-03T16:53:13Z")

</div>

waw nice... I definitely will have a look at [FlowFuse](https://flowfuse.com/) thanks

---

<div class="post-metadata">

**Author:** ![seb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seb/32/94157_2.png) [@seb](https://discourse.nodered.org/u/seb)\
**Post date:** [3 September 2024 16:59 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/7 "2024-09-03T16:59:19Z")

</div>

yes, I see it. The problem I'm facing is that there is a team creating docker with scripts (and all the dependencies with it) on them written in different languages (such as Python... but not only). So I can run the script with a single docker command line. Now I'd like to create node-red nodes that simply wrap each of those docker so that I can create flows. I guess that it would be something like calling a docker command from JS.... something like Docker in Docker (as node-red is already running in docker).... So wondering if any body did something similar...

I'll investicate what @Steve-Mcl suggested in [Create node that runs a docker while node-red is also running in docker - #4 by Steve-Mcl](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/4)

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [3 September 2024 19:51 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/8 "2024-09-03T19:51:56Z")

</div>

You could use this: [GitHub - philhawthorne/ha-dockermon: A NodeJS RESTful API which can be used with Home Assistant to report the state of Docker Containers](https://github.com/philhawthorne/ha-dockermon)  
It talks a lot about Home Assistant. But, in fact, it gives a rest interface to the docker engine, that is not linked at all to HA.  
You can either use that as an external container or embed the npm code into your nodered environment.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [3 September 2024 20:38 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/9 "2024-09-03T20:38:27Z")

</div>

i think that OP is mixing things that don't mix. A node is a node, a container is a container. There is no node that contains a container.

If you want to control containers from node-red you can use [dockerode](https://flows.nodered.org/node/node-red-contrib-dockerode)

---

<div class="post-metadata">

**Author:** ![seb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/seb/32/94157_2.png) [@seb](https://discourse.nodered.org/u/seb)\
**Post date:** [7 September 2024 17:03 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/10 "2024-09-07T17:03:26Z")

</div>

ok... I'll keep the heavy guns on docker but talking to node-red via messages.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 November 2024 17:04 UTC](https://discourse.nodered.org/t/create-node-that-runs-a-docker-while-node-red-is-also-running-in-docker/90659/11 "2024-11-06T17:04:22Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
