Hello, I try to create a custom docker image.
I followed the documentation well, but I can't launch the container. It doesn't find the entry point (see log below)
I have according the doc. modified the package.json file to include the scripts section
(the documentation is not precise enough on the syntax for me) See the snapshot below.
Could you please tell me where I'm doing things wrong? Thanks in advance.
I was a bit overwhelmed as well at first, but in essence all you need to do is put your flow file into your downloaded copy of that repository, put your dependencies in the package.json file and run the build shell script. I used the alpine Linux one as you end up with a smaller image, and it 'just worked'.
So can you update your package.json to make it more like mine (or test in the first place with my package.json) and check if that not fixes the problem ?
Here is the result, I used your file directly.
It doesn't work.
In the doc, it is well written that it is necessary to put a section scripts ?!
I can't even go into the container because it is stopped.
Maybe this is due to the use of Portainer.io to create the containers. (Or the architecture of the orangePi is not adapted)
Tested with no luck. It seems that it is not the same processor architecture. (Orange Pi PC - Chinese Raspberry Pi clone with Allwinner ARMv7 processor)
Indeed (my fault). It is expecting that the packages are installed under /data folder.
The following Dockerfile should work:
FROM nodered/node-red
COPY package.json /data/
# The following command will build all the nodes specified in the package.json that is copied
# in previous command.
RUN cd /data; npm install --unsafe-perm --no-update-notifier --no-fund --only=production
If that doesn't work then you can add an ENTRYPOINT to explicitly run the start specifying the /data folder as userDir.
FROM nodered/node-red:1.2.9-12
COPY package.json /data/
# The following command will build all the nodes specified in the package.json that is copied
# in previous command.
RUN cd /data; npm install --unsafe-perm --no-update-notifier --no-fund --only=production
ENTRYPOINT npm start -- --userDir /data
Yes, that's it, it works as desired.
The customised container works.
Variables go well in the directory, flows are well recognized, packages are well installed. It's cool,It's cool, it's pleasant.
The next step is coming.
Can I start a docker pull (upgrade) automatically from a live flow NR when there will be a new version that I will have dropped on dockerhub ?
I will investigate this now.
The never ending story, it's fun
The problem was that the docker command COPY package.json . that we used earlier is overwriting the existing node-red package.json that is specifying the start script. So that is the reason it couldn't find the start script.
So by copying it to another folder (e.g. to the /data folder) we fixed the problem.