# Image support storage plugin

**URL:** <https://discourse.nodered.org/t/image-support-storage-plugin/64385>\
**Category:** General\
**Tags:** docker\
**Created:** [26 June 2022 11:05 UTC](https://discourse.nodered.org/t/image-support-storage-plugin/64385 "2022-06-26T11:05:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![d0d04m3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/d0d04m3/32/19965_2.png) [@d0d04m3](https://discourse.nodered.org/u/d0d04m3)\
**Post date:** [26 June 2022 11:05 UTC](https://discourse.nodered.org/t/image-support-storage-plugin/64385/1 "2022-06-26T11:05:22Z")

</div>

hi  
any docker image to support mongodb storage plugin

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 June 2022 11:24 UTC](https://discourse.nodered.org/t/image-support-storage-plugin/64385/2 "2022-06-26T11:24:50Z")

</div>

Have you tried [node-red-mongo-storage-plugin - npm](https://www.npmjs.com/package/node-red-mongo-storage-plugin)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 June 2022 11:29 UTC](https://discourse.nodered.org/t/image-support-storage-plugin/64385/3 "2022-06-26T11:29:06Z")

</div>

I see you have edited your OP so my answer makes less sense now.

You may have to build your own image to include the mongo storage plugin

See [Running under Docker : Node-RED](https://nodered.org/docs/getting-started/docker)

---

<div class="post-metadata">

**Author:** ![d0d04m3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/d0d04m3/32/19965_2.png) [@d0d04m3](https://discourse.nodered.org/u/d0d04m3)\
**Post date:** [26 June 2022 12:52 UTC](https://discourse.nodered.org/t/image-support-storage-plugin/64385/4 "2022-06-26T12:52:32Z")

</div>

thx to reply but not work

```auto
2022-06-26 12:46:37.43 UTCnr-6b4cf6c8fd-c5m7nnr> node-red-docker@2.2.2 start /usr/src/node-red
2022-06-26 12:46:37.43 UTCnr-6b4cf6c8fd-c5m7nnr> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
2022-06-26 12:46:37.43 UTCnr-6b4cf6c8fd-c5m7nnr
2022-06-26 12:46:38.53 UTCnr-6b4cf6c8fd-c5m7nnr(node:17) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
2022-06-26 12:46:38.53 UTCnr-6b4cf6c8fd-c5m7nnr(Use `node --trace-warnings ...` to show where the warning was created)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr26 Jun 21:46:38 - [red] Uncaught Exception:
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr26 Jun 21:46:38 - [error] TypeError: Cannot read property 'db' of undefined
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at /usr/src/node-red/node_modules/node-red-mongo-storage-plugin/MongoHandler.js:22:33
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at /usr/src/node-red/node_modules/mongodb/lib/utils.js:695:9
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at /usr/src/node-red/node_modules/mongodb/lib/mongo_client.js:285:23
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at connectCallback (/usr/src/node-red/node_modules/mongodb/lib/operations/connect.js:367:5)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at /usr/src/node-red/node_modules/mongodb/lib/operations/connect.js:434:14
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Server.<anonymous> (/usr/src/node-red/node_modules/mongodb/lib/topologies/server.js:231:11)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Object.onceWrapper (events.js:520:26)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Server.emit (events.js:400:28)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Pool.<anonymous> (/usr/src/node-red/node_modules/mongodb/lib/core/topologies/server.js:439:21)
2022-06-26 12:46:38.54 UTCnr-6b4cf6c8fd-c5m7nnr at Pool.emit (events.js:400:28)
2022-06-26 12:46:38.55 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! code ELIFECYCLE
2022-06-26 12:46:38.55 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! errno 1
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! node-red-docker@2.2.2 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"`
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! Exit status 1
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! 
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! Failed at the node-red-docker@2.2.2 start script.
2022-06-26 12:46:38.56 UTCnr-6b4cf6c8fd-c5m7nnrnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.

```

so I am use this

> **[node-red-contrib-storage-mongodb](https://www.npmjs.com/package/node-red-contrib-storage-mongodb)**
>
> A MongoDB Node-RED Storage Plugin. Latest version: 0.0.2, last published: 2 years ago. Start using node-red-contrib-storage-mongodb in your project by running \`npm i node-red-contrib-storage-mongodb\`. There are no other projects in the npm registry...

node-red boot without error

```auto
2022-06-26 12:51:16.00 UTCnr-694ff4bf48-w6bd6[pod-event]Created container nr
2022-06-26 12:51:17.00 UTCnr-694ff4bf48-w6bd6[pod-event]Started container nr
2022-06-26 12:51:18.09 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:18.09 UTCnr-694ff4bf48-w6bd6nr> node-red-docker@2.2.2 start /usr/src/node-red
2022-06-26 12:51:18.09 UTCnr-694ff4bf48-w6bd6nr> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data"
2022-06-26 12:51:18.09 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:19 - [info] 
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nrWelcome to Node-RED
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr===================
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:19 - [info] Node-RED version: v2.2.2
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:19 - [info] Node.js version: v14.18.2
2022-06-26 12:51:19.74 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:19 - [info] Linux 5.4.0-1051-gke x64 LE
2022-06-26 12:51:20.10 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:20 - [info] Loading palette nodes
2022-06-26 12:51:20.12 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:20 - [error] Error: ENOENT: no such file or directory, open '/data/package.json'
2022-06-26 12:51:21.15 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Settings file : /data/settings.js
2022-06-26 12:51:21.15 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Context store : 'default' [module=memory]
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [warn] 
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr---------------------------------------------------------------------
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrYour flow credentials file is encrypted using a system-generated key.
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrIf the system-generated key is lost for any reason, your credentials
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrfile will not be recoverable, you will have to delete it and re-enter
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nryour credentials.
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrYou should set your own key using the 'credentialSecret' option in
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nryour settings file. Node-RED will then re-encrypt your credentials
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nrfile using your chosen key the next time you deploy a change.
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr---------------------------------------------------------------------
2022-06-26 12:51:21.22 UTCnr-694ff4bf48-w6bd6nr
2022-06-26 12:51:21.23 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Server now running at http://127.0.0.1:1880/
2022-06-26 12:51:21.23 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Starting flows
2022-06-26 12:51:21.24 UTCnr-694ff4bf48-w6bd6nr26 Jun 21:51:21 - [info] Started flows

```

but editor frozen when loading the nodes  
 ![Sans titre](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/3/a33f525498a42d82f0e2934c8c88626d2fe836d6.png)

add this pice to settings.json file

```auto
   storageModule: require('node-red-contrib-storage-mongodb/nrs'),
    mongodbSettings: {
        mongoURI: 'mongodb://mongodb:27017',
        appname: 'r1'
    },

```

dockerfile

```auto
FROM nodered/node-red:latest

COPY settings.js /data/
USER root
RUN chown -R node-red:root /data
USER node-red
RUN npm install --no-fund --no-update-notifier --save node-red-contrib-storage-mongodb
#RUN npm install --no-fund --no-update-notifier --save node-red-mongo-storage-plugin
ENTRYPOINT npm start -- --userDir /data

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 June 2022 13:33 UTC](https://discourse.nodered.org/t/image-support-storage-plugin/64385/5 "2022-06-26T13:33:42Z")

</div>

From your logs I see you are running Node-RED 2.2.2 on NodeJS v14.18.2 in docker

I would suggest the first step is to verify the plugin actually works for Node-RED 2.2.2 & NodeJS v14.18.2 OUTSIDE of docker.

If it does work outside of docker, then I would start looking at your docker networking and checking `mongoURI` etc.

If it does not work even outside of docker (with these version of node-red/nodejs), then I would raise an issue on the repository (or fork and fix yourself)

---

<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:** [25 August 2022 13:33 UTC](https://discourse.nodered.org/t/image-support-storage-plugin/64385/6 "2022-08-25T13:33:44Z")

</div>

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