I know not so many use docker and I am a beginner, but I am totally stuck !
My dockerfile ...
FROM nodered/node-red:3.1.3
RUN mkdir -p /data/gb/test
WORKDIR /data/gb/test
COPY test.txt /data/gb/test
This does create the folders in Node-RED /data folder.
But when I type into CLI ... docker compose up -d I get his error ?
Error response from daemon:
failed to create task for container: failed to create shim task:
OCI runtime create failed: runc create failed: unable to start container process:
exec: "./entrypoint.sh": stat ./entrypoint.sh: no such file or directory: unknown
I understand what you say, I have it all working, just some minor things like this are very frustrating.
I have Node-RED, Grafana, Sqlite and even Postrgres if I want to use that, all working in Docker desktop .
I originally took the docker route because i thought it would be easy to deploy and modify for my home automation project. mostly it is easy, but when I have spent all of yesterday trying to get this to work, it is not.
If I do
WORKDIR /usr/src/node-red
COPY test.txt .
This does work and creates the text file in that dir, but I cannot get it into /data ?
I have just re-read this section as I do have an external directory with package.json etc...
Dockerfile which copies in local resources
It can sometimes be useful to populate a Node-RED Docker image with files from a local directory (for example, if you want a whole project to be kept in a git repo). To do this, you’ll want your local directory to look like this:
Dockerfile
README.md
package.json # add any extra nodes your flow needs into your own package.json.
flows.json # the normal place Node-RED store your flows
flows_cred.json # credentials your flows may need
settings.js # your settings file NOTE: This method is NOT suitable if you want to mount the /data volume externally. If you need to use an external volume for persistence then copy your settings and flows files to that volume instead.
So perhaps i cannot do what I am trying to do, but I think I still had to do ... npm install in docker with the above.
So I thought it would be easier to do everything with a dockerfile and then I could include npm install in the dockerfile.
I have been working on this until late last night, so I am tired and a little confused as to what i have done
I am going to pause this topic, as I spent 10 hours yesterday trying to get this to work and for some reason now I cannot even create my folders in /data
I was able to do this yesterday, but I am not sure how as I have done the same today and it does not work.
I am going to start a new topic, this time showing you what I want to do, as I may have been doing this all wrong as I am a beginner in using Docker and Docker desktop .
Im runnng several NR environments on my docker environment. There are a few pre-requisites in my setup.
(i'm running Grafana, InfluxDB,mqtt,HA and others in parallel containers)
Tools
I'm running WEBMIN on my machine. This will simplify the managment of resources (mapping folders to NAS, create additional IP adresses, etc). It was just helpful to avoid the usual LINUX comand line setup
I'm using PORTAINER to manage my docker environment
Setup of DATA folder (seperate DATA folder required for every NR instance)
your should create a data folder outside your NR structuer (mkdir /NR/Data01 or so) ... or if you have a NAS you can generate a mountpoint with WEBMIN (here /mnt/TS/NR mounted to my shared NAS folder on 192.168.2.240)
Set variable PORT to 1880 (it has to be the same number as in 3)
Set variable TZ to your timezone setting (otherwise your timers in NR will be incorrect)
Set variable NODE_RED_ENABLE_SAFE_MODE to false or true....to disable or enable safe mode
Map the DATA folder to your NR environment/instance
setup the DATA folder in PORTAINER
make sure you have /data defined (this is the same for each NR instance)
map the /data folder to the NR folder of this instance (here /mnt/TS/NR) .. same folder as you created in 1)
--> Data-Folder --> Mount Point --> Local or remote stoarage path
--> /data --> /mnt/TS/NR --> 192.168.2.240 /Public/hp02/new_nr
Now you should be able to deploy your docker based NR istance/environment.
The benefits of this way are:
you can have multiple NR instances running (just ensure you have individual PORT's and DATA folders defined)
you will have access to your DATA folder from outside the docker environment like windows file manager (no specific docker command required to access, edit, copy or backup your data) ... see mapping in 1)
Thanks for all of that, it will take me some time to assess it all, today I plan to keep things fairly basic and just get the dockerfile working.
I am running Linux on my host PC so things maybe a little different.
I think I already have a similar structure as I have bind mounts to folders external to Docker.
I will look at WEBMIN & PORTAINER in the near future on Youtube, as that is how I learn best.
I am sure I will have to ask you much more in the future ( if that's ok ? ), but for now I am going to concentrate on getting one instance of Node-RED working in docker with my own Node-RED docker image ?
When you do it your way do you pre-populate the Manage palette menu ?
I did the manual bind as well (with Lunux cmd) but failed due to wrong or missing parameters. E.g. I was not able to edit or add files manually to the data folder.
Only when using WEBMIN, with these parameters (see screenshot in 1) I was able to fully use the remote NAS location as data drive for NR