Docker + Node-RED

Hi!

I have installed docker, running a node-red image.
Can anybody tell me where the user (seems to be node-red / default setting) home directory is located when I let node-red write a file? It seems to work, since the file is still there even if I restart the image… but I can’t find the file when I go down to DietPi, because the default directory /usr/src/node-red doesn’t exist…

Thanks in advance!
Florian

It depends how you configured the container yourself. You can’t compare file location with other native installations.

Thanks Joulinar for your reply,

am I right that in a “standard config” the container itself can have a volume (e.g. mounted as /data) but has also a location for “non persistent” data which is located - where?

I started / installed the container with a command like this:

docker run --name Node-RED --network NetworkBridge --ip 172.99.0.2 -p 80:1880 --restart unless-stopped --volume nodered_data:/data -d nodered/node-red:latest

So docker pulls the new image and I can access the volume /data inside the container. Node-RED is run under user “node-red”, and when I save some documents in the user’s storage - I can’t find the documents when I’m searching for it in the host machine - right?

I guess you created a Docker volume nodered_data right? Usually these Docker volume are located at /mnt/dietpi_userdata/docker-data/volumes.

Yes, that’s what I find.
The volume I created is mounted at /data inside the container.
But it’s not the user (node-red)'s home directory.

You completely misunderstood how docker is working, could that be? Node is running inside the container only. There should be no node user existing outside the container. The data directory is the only one existing outside the container and this is one is locked at the volume location I shared above. For whatever happen inside the container, you would need to ask container developer.

Well…
Let me explain, what I see, and where my misunderstanding might be.

In Node-RED (inside the container) I can use a exec node to run external commands on the host system of Node-RED which is - in this case - the container. Running “whoami” gives me back “node-red”. So I think this should be the user who is running Node-RED.

Now when I write a file in this user’s context, I can do it - of course - to the mounted volume /data, but I can also write a file just where I am (as user node-red) > but you’re right: I should ask at node-red, where the docker image comes from…

As said, what happen inside the container will stay inside the container. The only way to share files between container and outside world, is to use the Docker volume.

Yes, I think, I’ve got it.

But even if it’s inside the container, it will be stored - but only as long as I don’t pull a new version of the image, right?

Yes

I assume, that’s what I found out in the meantime:
Node-RED Forum

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