# Where is the root directory of node-red in the docker image?

**URL:** https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541
**Category:** General
**Tags:** docker
**Created:** [21 December 2021 20:36 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541 "2021-12-21T20:36:55Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![TheYolo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/theyolo/32/52929_2.png) [@TheYolo](https://discourse.nodered.org/u/TheYolo)
#### Post date: [21 December 2021 20:36 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541/1 "2021-12-21T20:36:55Z")

</div>

Hello,

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/?

When installing extensions they state I have to be in the root directory (example: [node-red-contrib-elasticsearch-jd (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-elasticsearch-jd)).

My current Dockerfile:

```auto
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?

---

<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: [21 December 2021 22:06 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541/2 "2021-12-21T22:06:47Z")

</div>

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)](https://nodered.org/docs/getting-started/docker).

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.

---

<div class="post-metadata">

### Author: ![TheYolo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/theyolo/32/52929_2.png) [@TheYolo](https://discourse.nodered.org/u/TheYolo)
#### Post date: [21 December 2021 23:12 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541/3 "2021-12-21T23:12:40Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![bogi](https://avatars.discourse-cdn.com/v4/letter/b/e47774/32.png) [@bogi](https://discourse.nodered.org/u/bogi)
#### Post date: [22 December 2021 00:46 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541/4 "2021-12-22T00:46:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [22 December 2021 05:08 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541/5 "2021-12-22T05:08:02Z")

</div>

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](https://nodered.org/docs/getting-started/docker#using-a-host-directory-for-persistence-bind-mount) (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`

---

<div class="post-metadata">

### Author: ![bogi](https://avatars.discourse-cdn.com/v4/letter/b/e47774/32.png) [@bogi](https://discourse.nodered.org/u/bogi)
#### Post date: [22 December 2021 06:18 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541/6 "2021-12-22T06:18:05Z")

</div>

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:

```auto
-----------------------------------------------------------
2021-12-22T06:09:33.828Z Install : node-red-contrib-ui-svg 2.3.1

2021-12-22T06:09:37.026Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-ui-svg@2.3.1

```

and after some minute:

```auto

-----------------------------------------------------------
2021-12-22T06:09:33.828Z Install : node-red-contrib-ui-svg 2.3.1

2021-12-22T06:09:37.026Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-ui-svg@2.3.1
2021-12-22T06:10:54.178Z [err] npm
2021-12-22T06:10:54.178Z [err] ERR! code ECONNRESET
2021-12-22T06:10:54.179Z [err] npm
2021-12-22T06:10:54.179Z [err] ERR!
2021-12-22T06:10:54.179Z [err] errno
2021-12-22T06:10:54.179Z [err] ECONNRESET
2021-12-22T06:10:54.185Z [err] npm
2021-12-22T06:10:54.185Z [err] ERR! network
2021-12-22T06:10:54.185Z [err] request to https://registry.npmjs.org/node-red-contrib-ui-svg failed, reason: read ECONNRESET
2021-12-22T06:10:54.185Z [err] npm 
2021-12-22T06:10:54.185Z [err] ERR! 
2021-12-22T06:10:54.185Z [err] network This is a problem related to network connectivity.
2021-12-22T06:10:54.185Z [err] npm 
2021-12-22T06:10:54.185Z [err] ERR! 
2021-12-22T06:10:54.185Z [err] network
2021-12-22T06:10:54.185Z [err] In most cases you are behind a proxy or have bad network settings.
2021-12-22T06:10:54.185Z [err] npm
2021-12-22T06:10:54.185Z [err] ERR!
2021-12-22T06:10:54.186Z [err] network
2021-12-22T06:10:54.186Z [err]  
2021-12-22T06:10:54.186Z [err] npm
2021-12-22T06:10:54.186Z [err] ERR!
2021-12-22T06:10:54.186Z [err] network
2021-12-22T06:10:54.186Z [err] If you are behind a proxy, please make sure that the
2021-12-22T06:10:54.186Z [err] npm 
2021-12-22T06:10:54.186Z [err] ERR! 
2021-12-22T06:10:54.186Z [err] network 'proxy' config is set properly. See: 'npm help config'
2021-12-22T06:10:54.238Z [err] 
2021-12-22T06:10:54.238Z [err] npm ERR!
2021-12-22T06:10:54.238Z [err] A complete log of this run can be found in:
2021-12-22T06:10:54.238Z [err] npm ERR!
2021-12-22T06:10:54.238Z [err] /data/.npm/_logs/2021-12-22T06_10_54_188Z-debug.log
2021-12-22T06:10:54.249Z rc=1

```

I'm working on offshore installation and "IT policy", "cyber security" rules here are rigid and no one will allow to change any proxy settings etc...

I found option to "upload module tgz file" but how can i find tgz files for:  
node-red-contrib-ui-svg  
node-red-contrib-drawsvg  
and more...  
Thanks!

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [22 December 2021 07:20 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541/7 "2021-12-22T07:20:33Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)
#### Post date: [22 December 2021 08:05 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541/8 "2021-12-22T08:05:48Z")

</div>

You can pass on environment variables on the docker command line with the `-e` option.

And I've answered the tgz question on the other thread

---

<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: [5 January 2022 08:06 UTC](https://discourse.nodered.org/t/where-is-the-root-directory-of-node-red-in-the-docker-image/55541/9 "2022-01-05T08:06:08Z")

</div>

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