I'm trying to install a package to my image I'm building. I've been searching around on the base image (nodered/node-red) and it seems to be /usr/src/node-red/?
FROM nodered/node-red
WORKDIR /usr/src/node-red/
RUN npm install node-red-contrib-elasticsearch-jd
But when I run the container I don't see any of the new features. So I installed it to the wrong directory? Could anyone point me to the root directory of the node-red install on the docker hub image?
You generally don't install anything to the node-red root. You install packages containing nodes to the userDir folder. That defaults to ~/.node-red on a "standard" install. For the standard Docker build, that folder is /data/ as stated in the docs Running under Docker : Node-RED (nodered.org).
Those same docs show you how to get into your docker instance as a terminal.
Further down that same page, it tells you how you can have your own custom /data/ folder which is what you are wanting to do I think.
Thank you for reply. I mounted /data on my host machine and was from there able to install the packages needed. Simply.
I don't really need a custom image any longer
I feel this is my case as well. Could you please explain that using words for neewbie? I know that using Docker some user data is kept inside container folder and this one in mapped to the external (external to the container) folder /node-red/data right? So if i want to install new packages i need to run
nmp install command form /data folder - so not from inside of the container but using Pi terminal, right?
Yes, i was reading the above mentioned docs, however, Linux, Docker is still kinda magic for me, sorry.
The idea of (docker) containers is that they only "contain" the program - no user data - consider them read-only.
User data should always be outside the container (and thus) mapped to the host. The mapping is decided upon creation of the container by means of the -v option (-volume), see documentation (bind mount)
-v <host path>:<path in container>
Use the node-red UI to install packages and they will be installed in <host path>/node_modules
Thank you bakman2 for clarification. It is now easy. Well almost. I know where to install modules so Node-RED UI -> user settings -> Palette -> install -> here i found the one i need, confirmed intallation and:
I am not sure how one can configure a proxy in docker, maybe as an environment variable (eg: -e http_proxy=http://myproxy.com:8080 when creating the container), perhaps @dceejay has some guidance.