# Deployed flow in Azure Container Instances disappears

**URL:** <https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618>\
**Category:** General\
**Created:** [21 October 2020 06:59 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618 "2020-10-21T06:59:57Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![tobiaspe](https://avatars.discourse-cdn.com/v4/letter/t/8edcca/32.png) [@tobiaspe](https://discourse.nodered.org/u/tobiaspe)\
**Post date:** [21 October 2020 06:59 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/1 "2020-10-21T06:59:58Z")

</div>

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?

 ![Screen Shot 2020-10-17 at 09.21.08](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b6cc47dfdd501d6c9c5f6adbfbe6e58284ddd817.png)

---

<div class="post-metadata">

**Author:** ![bbergshaven](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bbergshaven/32/55658_2.png) [@bbergshaven](https://discourse.nodered.org/u/bbergshaven)\
**Post date:** [21 October 2020 12:54 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/2 "2020-10-21T12:54:04Z")

</div>

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.

Let me know if you need any more input.

Regards  
Bernt-Johan

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 October 2020 13:01 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/3 "2020-10-21T13:01:23Z")

</div>

For more info see - [https://github.com/node-red/node-red-docker/blob/master/volumechanges.md](https://github.com/node-red/node-red-docker/blob/master/volumechanges.md)

---

<div class="post-metadata">

**Author:** ![hammoaj](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hammoaj/32/1998_2.png) [@hammoaj](https://discourse.nodered.org/u/hammoaj)\
**Post date:** [21 October 2020 13:56 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/4 "2020-10-21T13:56:24Z")

</div>

The two things that you need to do are documented in here already but to emphasise:

- You should configure a fixed name for the settings.js file (which is the default I think in the docker image)
- You must configure a persistent storage volume to be mounted on /data otherwise you will indeed lose your flows every time you redeploy.

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [21 October 2020 14:32 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/5 "2020-10-21T14:32:31Z")

</div>

Hi @tobiaspe,

The flows you create/edit are stored under the `/data` folder.  
It is important that the `/data` folder is mounted to a [docker volume](https://docs.docker.com/storage/volumes/) 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.

See also following node-red documentation:

- [https://nodered.org/docs/getting-started/docker#managing-user-data](https://nodered.org/docs/getting-started/docker#managing-user-data)

Does this help ?

jan

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [21 October 2020 15:15 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/6 "2020-10-21T15:15:01Z")

</div>

> [@tobiaspe](#):
>
> 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.

I did some further digging in the azure documentation:

- [Manually stop or start container group - Azure Container Instances | Microsoft Learn](https://docs.microsoft.com/en-us/azure/container-instances/container-instances-stop-start)

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.

> [@tobiaspe](#):
>
> How can I keep my flows intact? Do I have to create Container Groups in order to make this more stable?

To overcome this you must assure that the flows are not stored in the writable container layer but outside the container in a volume.

So for this you need to

1. create an Azure file share:  
[Mount Azure Files volume to container group - Azure Container Instances | Microsoft Learn](https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-azure-files)
2. mount the Azure file share as a volume in the container with mount path `/data`

---

<div class="post-metadata">

**Author:** ![tobiaspe](https://avatars.discourse-cdn.com/v4/letter/t/8edcca/32.png) [@tobiaspe](https://discourse.nodered.org/u/tobiaspe)\
**Post date:** [22 October 2020 06:26 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/7 "2020-10-22T06:26:30Z")

</div>

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?

I have deployed through the Azure Portal as described in [https://docs.microsoft.com/en-us/azure/container-instances/container-instances-quickstart-portal](https://docs.microsoft.com/en-us/azure/container-instances/container-instances-quickstart-portal) and used the latest Node-Red image from Docker Hub.

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [22 October 2020 08:55 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/8 "2020-10-22T08:55:07Z")

</div>

> [@tobiaspe](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![tobiaspe](https://avatars.discourse-cdn.com/v4/letter/t/8edcca/32.png) [@tobiaspe](https://discourse.nodered.org/u/tobiaspe)\
**Post date:** [27 October 2020 13:41 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/9 "2020-10-27T13:41:11Z")

</div>

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?

 ![Screenshot (255)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/a/1a80982a8aa39e5cd745f4ee2ae9ab0de42fee09.png)

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [29 October 2020 16:40 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/10 "2020-10-29T16:40:37Z")

</div>

> [@tobiaspe](#):
>
> Well, I would like to interact with the ACI Container, or rather the underlying Settings file.

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.

---

<div class="post-metadata">

**Author:** ![tobiaspe](https://avatars.discourse-cdn.com/v4/letter/t/8edcca/32.png) [@tobiaspe](https://discourse.nodered.org/u/tobiaspe)\
**Post date:** [1 November 2020 11:26 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/11 "2020-11-01T11:26:55Z")

</div>

Yes, but where do I do that?

Do I access the container from inside the Azure Portal?

Using Connect directly under the Azure Container Instance using Bash commands?

Where do I run any similar commands and access the Node-Red files?

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [1 November 2020 11:59 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/12 "2020-11-01T11:59:26Z")

</div>

> [@tobiaspe](#):
>
> Using Connect directly under the Azure Container Instance using Bash commands?

Yes, that is a way you can do it. I guess you can use nano, vi or vim as editor for editing the settings file.

---

<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:** [22 December 2020 23:27 UTC](https://discourse.nodered.org/t/deployed-flow-in-azure-container-instances-disappears/34618/13 "2020-12-22T23:27:49Z")

</div>

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