Node Red Docker - New File as Root

I am creating a .txt file within node red that is running in a Docker Container. (Default settings apart from having a external folder linked to the container. )
The file is created with a simple inject and all of that is working well but the created file's Owner is root and that creates problems if I would like external access to the file.

Is there a way to set Node Red as a local user instead of root within Docker?

You could possibly change the file ownership from within the container. Running something chown uid:gid filename (using an exec node) and using the UID and GID numbers of your normal user account on the system. This is if the NR user within Docker is a root account.

Otherwise you could try changing the permission to be readable/writable by all users: chmod a+rwx file (also using an exec node).

If you just need to read the files then I think if you change the access mode of the directories /var/lib/docker and /var/lib/docker/volumes to 755 then you should be able to read files in the docker volumes, if that is what you are trying to do.

@Paulf007 mentioned external folder linked to the container so I assumed he's using volume mounts to host file system dirs.

Yes , that is correct.
I have played with the following command within node red

chown -R 1000:1000 /mydata

and that seems to do the trick. I will still play with it a bit more to make sure all is working well.

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