Linked Docker Container

Hi, I am very new to Node-Red and Docker. I've created two docker containers - one runs node-red and the other a console application. In my docker-compose file, I am linking the console container to the node-red container. What I don't understand is, how do I run the console container from my node-red flow?

If I don't put node-red in a container, then I can use the Exec node to run command 'docker run...' and it will run my console app. When I try to do this same thing with node-red running in a container, I get an error "docker: not found"

Any help will be appreciated! Thank you

I'm pretty sure that an application running in docker didn't have awareness or access to docker (think inception).

There options...
What is it this console application does? Could you replicate is functionally in node red?

Alternatively, could this console application communicate via MQTT? Or a socket? Or a http endpoint/API? Node red is perfect for that type of communication.

Lastly, you could modify the docker image and simply copy the console application to the node red container then use a exec (without docker run).

Thank you for the reply, I appreciate it.

The console app will likely have more logic in it than I'd like to put into Node-Red.

I had tried putting the console app in the image, but wasn't having success. It's a .net core console app and I couldn't get it to run. However, I finally figured out how to publish it as a self-contained application and targeted the linux os. I copied that to the image and can now run it from the Exec module.

Thank you for nudging me back in the right direction.

1 Like