TCP in Node Red Docker Container

Hello,

I have node red running in a docker container on a raspberry pi and I am trying to send commands over TCP/IP using the TCP I/O node to another computer on my network that runs a server. However, because the docker container is on its own network within the pi (which is on the network the computer is on) and isn't addressable outside the pi I can't make the TCP connection. Is there any way to fix this inside of node red or will I have to create some sort of forwarding script to forward the TCP request from node red to the external server. Any help with this would be very appreciated. Thank you for reading and for helping with this.

Welcome to the Forums @jmcauliffe

No. Node RED (or any other application) inside a container, will know nothing about the "real world".

Many here use Node RED bare metal, and do not use any form of OS layering. Unless someone here can advise (I'm sure some do use this type of setup) you will need to investigate how to configure your containers to use the real network.

Your options are run node-red outside of a container, pop over to a docker forum and ask "what docker settings do I need to set to permit TCP communications in / out of a container" or read the docs...

You likely just want to use the host driver but you need to be aware of what that means to security and isolation.

In other words, probably wise to ask on a docker centric forum.

1 Like

It isn't too hard, you simply need to tell the container to expose the TCP/IP port you want to use. And just remember that the IP address of Node-RED seen from outside Docker will be different to inside.

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