# How to add custom nodes while running node-red inside docker? (without creating a npm package)

**URL:** <https://discourse.nodered.org/t/how-to-add-custom-nodes-while-running-node-red-inside-docker-without-creating-a-npm-package/76740>\
**Category:** Developing Nodes\
**Tags:** docker\
**Created:** [20 March 2023 10:13 UTC](https://discourse.nodered.org/t/how-to-add-custom-nodes-while-running-node-red-inside-docker-without-creating-a-npm-package/76740 "2023-03-20T10:13:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sabir](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@sabir](https://discourse.nodered.org/u/sabir)\
**Post date:** [20 March 2023 10:13 UTC](https://discourse.nodered.org/t/how-to-add-custom-nodes-while-running-node-red-inside-docker-without-creating-a-npm-package/76740/1 "2023-03-20T10:13:13Z")

</div>

For locally running node-red  
I do

```auto
cd ~/.node-red
npm install ~/dev/node-red-contrib-example-lower-case

```

Same things I want to achieve but inside docker node-red

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [20 March 2023 11:29 UTC](https://discourse.nodered.org/t/how-to-add-custom-nodes-while-running-node-red-inside-docker-without-creating-a-npm-package/76740/2 "2023-03-20T11:29:36Z")

</div>

Hi @sabir

You still need to create the skeleton of the NPM package along with its `package.json` file etc etc.

Here is the step 1 can take (there are a few ways)

1. run **npm pack** in the root directory that your node is - this will create the file that is usually uploaded to NPM (but we wont do that)

2. Install the file to Node RED using the UI - there is an option to upload.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c4b2e1a014867bb32c2b4e5e1f179ad37eefde30.png)

A caveat you might need to be wary of, is during development, to increase the version number for each upload.

As mentioned, there are a few ways - but as I don't use docker (many who do of course), I'm not sure of the other ways

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [20 March 2023 12:28 UTC](https://discourse.nodered.org/t/how-to-add-custom-nodes-while-running-node-red-inside-docker-without-creating-a-npm-package/76740/3 "2023-03-20T12:28:25Z")

</div>

> [@sabir](#):
>
> Same things I want to achieve but inside docker node-red

I think you can do the same for Docker in that the Docker data folder holds your userDir folder and so you need to do the install there.

Obviously, you need to restart Node-RED after each change to your source-code though, not sure how you do that with the docker version.

Normally for dev, I run Node-RED locally using PM2 and use PM2's watch facilities to watch for file changes in nodes being developed (and settings.js, etc) so that it restarts node-red for me.

---

<div class="post-metadata">

**Author:** ![sabir](https://avatars.discourse-cdn.com/v4/letter/s/b5e925/32.png) [@sabir](https://discourse.nodered.org/u/sabir)\
**Post date:** [4 April 2023 12:19 UTC](https://discourse.nodered.org/t/how-to-add-custom-nodes-while-running-node-red-inside-docker-without-creating-a-npm-package/76740/4 "2023-04-04T12:19:43Z")

</div>

Thanks for response  
**This is what works for me**

**Dockerfile**

> FROM nodered/node-red:latest  
> COPY settings.js /data/  
> USER root  
> RUN mkdir /data/nodes  
> COPY ./custom-node /data/nodes  
> RUN chown -R node-red:node-red /data/nodes  
> USER node-red  
> RUN cd /data/nodes && npm install  
> USER node-red  
> RUN npm install --no-fund --no-update-notifier --save node-red-contrib-storage-mongodb

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 April 2023 12:20 UTC](https://discourse.nodered.org/t/how-to-add-custom-nodes-while-running-node-red-inside-docker-without-creating-a-npm-package/76740/5 "2023-04-18T12:20:11Z")

</div>

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