# Docker image with custom lib folder

**URL:** <https://discourse.nodered.org/t/docker-image-with-custom-lib-folder/35876>\
**Category:** General\
**Created:** [13 November 2020 16:16 UTC](https://discourse.nodered.org/t/docker-image-with-custom-lib-folder/35876 "2020-11-13T16:16:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [13 November 2020 16:16 UTC](https://discourse.nodered.org/t/docker-image-with-custom-lib-folder/35876/1 "2020-11-13T16:16:04Z")

</div>

Hello,

We're working on a custom Node-RED Docker image that will have project mode enabled by default.  
The workflow is the user will run the container and create a project or clone an existing one.  
I would like to provide a custom lib folder for the image which would have a collection of flows/javascript snippets. Since the lib folder is at the project level I'm trying to figure out how I could manage to have a global lib folder at the image level. My first instinct would be to somehow copy the global lib folder to the correct path in settings.js although I'm not sure I can know the path of the project from there.  
Any other thoughts on how to do this ?

Thanks !

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [13 November 2020 16:47 UTC](https://discourse.nodered.org/t/docker-image-with-custom-lib-folder/35876/2 "2020-11-13T16:47:23Z")

</div>

Do you mean you want to pre-populate the `<userDir>/lib` folder with content? And you want that content to come from the checked-out project?

At the moment, there's no relationship between a project and the lib directory. You could pre-populate `<userDir>/lib` as part of your Docker build, but there's no way to trigger that when the user clones a new project within the image.

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [13 November 2020 16:49 UTC](https://discourse.nodered.org/t/docker-image-with-custom-lib-folder/35876/3 "2020-11-13T16:49:07Z")

</div>

I guess my question is, if I put pre-populate my data in `<userDir>/lib`, will it appear for the user if he creates/clones a project ?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [13 November 2020 16:50 UTC](https://discourse.nodered.org/t/docker-image-with-custom-lib-folder/35876/4 "2020-11-13T16:50:56Z")

</div>

The built-in library is completely unrelated to projects. The content will appear whatever the user does - with projects, without projects.

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [13 November 2020 16:51 UTC](https://discourse.nodered.org/t/docker-image-with-custom-lib-folder/35876/5 "2020-11-13T16:51:26Z")

</div>

Thanks ! I was over-thinking then, already does what I need 🙂

---

<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:** [27 November 2020 16:51 UTC](https://discourse.nodered.org/t/docker-image-with-custom-lib-folder/35876/6 "2020-11-27T16:51:28Z")

</div>

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