Hi, according to the Node Red Docker Github, you can add extra nodes via a Dockerfile.
However, I am unable to get this to work with the same Dockerfile. Any pointers or ideas why this wouldn't be the case?
I am running Docker on WSL / Ubuntu for context.
you need to login into your NR docker container with
sudo docker exec -it <mycontainer> bash
than you can execute the npm command and add other packages
Thanks for your prompt reply. I have got packages installed this way, however I wish to deploy this container to many different devices with minimal manual input (for a commercial application), so I was hoping to streamline this process and have the Dockerfile control all of the package installations.
you can backup/zip an entire docker container and deploy to other systems easily ... but this docker specific and not related to NR .. so you will not find much help here
I understand, my frustration moreso lies in that the Node Red Docker documentation does not work as expected and I would like to know if it's a 'me problem' or a NR Image / Permissions issue. I would prefer to avoid zipped containers for distribution
I don't think you will be able to provide additional NPM packages as part of the docker-compose file as they need to be installed after the NR docker instance is running
I am not trying to provide additional NPM packages as part of the docker-compose file. I am trying to provide them as part of the Dockerfile, as per the screenshot from the documentation provided by NR. If the instance needs to be running to install additional NPM packages, they should update these instructions accordingly. Pretty sure that defeats the whole purpose of containerization. Right?
I have seen several discussion here in the forum on how to handle/install local NPM packages, but as per my understanding the NPM packages will always be downloaded for install. I don't think it will work offline or in local mode.
But there are others here with more on this topic sorry cant help futher
1 Like
What happens exactly ?
You could instead add the packages to package.json, under the dependencies property and rebuild.
@xx_Nexus_xx
you need to login into your NR docker container with
The concept of a docker container is that they should be considered immutable and are disposable.
Once you update the container, the package is gone. Adding stuff to the container this way is a big no-no and completely missing the point.
1 Like
Sorry I had to re-edit this entire post because I forgot to check my own setup.
Turns out I needed to specifically add package.json to the image in the Dockerfile:
COPY package.json .
This is done in "Stage BASE" after WORKDIR is set.
What I do is add any packages on host, either through npm or palette or whatever. This will update package.json. After that, I can build the image, copying the package.json from the mount/project folder into the image.