I have used Azure Container Instances to stand-up different Node-Red containers multiple times.
It is quickly done and everything seem to go as intended.
I can access and deploy Node-Red flows without any problems, set up HTTP In nodes that are
publicly available and save some Flow Variables to keep state (used for required user settings).
Without warning though, at some time, the deployed flows are all deleted, likely because the container restarted and pulled the Node-Red image automatically again.
Why does it do that? How can I keep my flows intact? Do I have to create Container Groups in order to make this more stable?
Hello @tobiaspe
I have noticed similar problems when running node-red in Kubernetes. For me, the problem was that the flow files are postfixed with the hostname, and every time a new container was created the hostname changed. Try setting the flow file to a fixed name in the settings.js and see if that helps.
You will also need to define a static volume that you mount the user-data folder in so that those files are kept during recreation.
The flows you create/edit are stored under the /data folder.
It is important that the /data folder is mounted to a docker volume in order to assure that you don't loose the flows you have edited/created when replacing the docker image with a new docker image version.
So when you stop your container group it recycles everything - so the container state is not preserved.
So if flows are stored in the writable container layer they are all lost.
When restarting a container it will pull a new image if the container image is updated which most likely is the case as recently a new node-red image version is available on docker hub.
So this new image, will complete replace the old image including the writable container layer containing the flows you have stored there.
To overcome this you must assure that the flows are not stored in the writable container layer but outside the container in a volume.
Thanks a million for all your replies, they were all very very valuable and I now understand much more on what I need to setup to make my flow persist over a container restart/repull.
But a really stupid question. am I to run the CLI and command within the "Connect To" using Bash in my actual Container Instance? Or do I somehow access the Container Instance container from Docker? How do I run the examples on how to set this up through/to my deployed Node-Red container?
It is not fully clear what you want to do ? Which examples do you want to run ?
Using node-red editor you can easily import flows that you have copied to the clipboard.
Well, I would like to interact with the ACI Container, or rather the underlying Settings file. How do I connect to the underlying files of the Node-Red container. From the Azure Portal I can use Connect and then run bash commands (see screen dump).
Is there another way of interacting with underlying Node-Red container and its files?
Do you want to change the node-red settings file ?
I think you can find it at location /data/settings.js
If it is it not there then try creating a setting.js in that location.
Take care that you need to stop and start node-red container in order to assure it will take your file changes into account.