Tips for managing node ports with docker

#1

I've been using nodered directly on ubuntu but recently decided to migrate my services to docker. I just realized that with nodered in a docker container I'm losing flexibility in node management if a new node brings in a unique port. Im not a docker power user by any means. Is there an easy way to manage the available ports that a docker container exposes? I was thinking either a DMZ (not preferred) or am hopeful that nodered has a built in broker for managing a range of ports that nodes have access to. Thanks in advance!

0 Likes

#2

I'm not that familiar with Docker but I believe that you would either need to pre-define the ports you might need in your Docker environment or change the environment as and when needed. Node-RED itself can't do anything to the Docker environment as far as I know.

0 Likes

#3

I think I can simplify the question: is there a way in node-red to restrict the set of ports that nodes can use?

0 Likes

#4

No. Node-RED itself knows nothing about docker.. You could however potentially set ports values using environment variables so that you could set them at invocation time..

This may not be possible for all nodes.

0 Likes

#5

Thanks for the replies. I finally realized that you can simply use the os to manage available ports in conjunction with docker. IMO it’s really not worth the effort to maintain a docker container in this manner unless have dedicate workflows that don’t change.

0 Likes