# Cannot seem to start Node-RED Docker custom container

**URL:** <https://discourse.nodered.org/t/cannot-seem-to-start-node-red-docker-custom-container/26168>\
**Category:** General\
**Created:** [6 May 2020 12:25 UTC](https://discourse.nodered.org/t/cannot-seem-to-start-node-red-docker-custom-container/26168 "2020-05-06T12:25:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmsaini](https://avatars.discourse-cdn.com/v4/letter/n/b38774/32.png) [@nmsaini](https://discourse.nodered.org/u/nmsaini)\
**Post date:** [6 May 2020 12:25 UTC](https://discourse.nodered.org/t/cannot-seem-to-start-node-red-docker-custom-container/26168/1 "2020-05-06T12:25:29Z")

</div>

I need help with starting my container.  
I followed all the steps here [https://nodered.org/docs/getting-started/docker](https://nodered.org/docs/getting-started/docker) to build my image.  
However, when I try to start/run the container it exits with the following error in the logs.

Here is my Dockerfile:

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

COPY package.json .
RUN npm install --only=production

# Copy _your_ Node-RED project files into place
COPY settings.js /data/settings.js
COPY flows.json /data/flows.json

# Start the container normally
# CMD ["npm", "start", "--", "--userDir", "/data"]
CMD ["npm", "start"]

```

docker logs 75f4b1582b1d

```auto
> node-red-project@0.0.1 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data" "npm" "start"

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/usr/src/node-red/node_modules/node-red/red.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-red-project@0.0.1 start: `node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data" "npm" "start"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-red-project@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /usr/src/node-red/.npm/_logs/2020-05-06T12_11_18_034Z-debug.log

```

Can someone please help! Why would that module be missing if I am using the official base image. What am I doing wrong?

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:** [6 May 2020 12:32 UTC](https://discourse.nodered.org/t/cannot-seem-to-start-node-red-docker-custom-container/26168/2 "2020-05-06T12:32:13Z")

</div>

The page you linked contains a lot of information. Which specific steps did you follow ? You say "to build my image" are you creating your own container ?

---

<div class="post-metadata">

**Author:** ![nmsaini](https://avatars.discourse-cdn.com/v4/letter/n/b38774/32.png) [@nmsaini](https://discourse.nodered.org/u/nmsaini)\
**Post date:** [6 May 2020 12:45 UTC](https://discourse.nodered.org/t/cannot-seem-to-start-node-red-docker-custom-container/26168/3 "2020-05-06T12:45:34Z")

</div>

Yes I am building my own image using docker build.  
I have posted my Dockerfile in the message above.

Thanks!

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [6 May 2020 12:48 UTC](https://discourse.nodered.org/t/cannot-seem-to-start-node-red-docker-custom-container/26168/4 "2020-05-06T12:48:59Z")

</div>

> [@nmsaini](#):
>
> Error: Cannot find module '/usr/src/node-red/node\_modules/node-red/red.js'

Have you verified that the path is correct and that node-red is indeed installed there?

---

<div class="post-metadata">

**Author:** ![nmsaini](https://avatars.discourse-cdn.com/v4/letter/n/b38774/32.png) [@nmsaini](https://discourse.nodered.org/u/nmsaini)\
**Post date:** [6 May 2020 13:09 UTC](https://discourse.nodered.org/t/cannot-seem-to-start-node-red-docker-custom-container/26168/5 "2020-05-06T13:09:46Z")

</div>

ok thanks for that hint @afelix. I did and there wasn't any node\_module/node-red.  
So I figured my package.json file was over-writing the original and that was messing up the install. So I changed my dockerfile to

COPY package.json /data/

However, now it is not installing the sqlite package I need for my flows. I can of-course go in after the container is up and then re-install the "node-red-node-sqlite" package. Something is missing from the instructions as I should be able to simply take my flow and rebuild a image with everything.

These are the new logs -

```auto
> node-red-docker@1.0.6 start /usr/src/node-red
> node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data" "npm" "start"

6 May 12:57:47 - [info]

Welcome to Node-RED
===================

6 May 12:57:47 - [info] Node-RED version: v1.0.6
6 May 12:57:47 - [info] Node.js version: v10.20.1
6 May 12:57:47 - [info] Linux 4.18.0-193.10.el8.x86_64 x64 LE
6 May 12:57:48 - [info] Loading palette nodes
6 May 12:57:48 - [info] Settings file : /data/settings.js
6 May 12:57:48 - [info] Context store : 'memoryOnly' [module=memory]
6 May 12:57:48 - [info] User directory : /data
6 May 12:57:48 - [warn] Projects disabled : editorTheme.projects.enabled=false
6 May 12:57:48 - [info] Flows file : /data/flows.json
6 May 12:57:48 - [warn]

---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------

6 May 12:57:48 - [info] Server now running at http://127.0.0.1:1880/
6 May 12:57:48 - [info] Waiting for missing types to be registered:
6 May 12:57:48 - [info] - sqlitedb
6 May 12:57:48 - [info] - sqlite

```

---

<div class="post-metadata">

**Author:** ![nmsaini](https://avatars.discourse-cdn.com/v4/letter/n/b38774/32.png) [@nmsaini](https://discourse.nodered.org/u/nmsaini)\
**Post date:** [6 May 2020 13:24 UTC](https://discourse.nodered.org/t/cannot-seem-to-start-node-red-docker-custom-container/26168/6 "2020-05-06T13:24:25Z")

</div>

I got it working.

Thanks for all your input.

The package.json file didn't have "node-red" as a dependency and therefore npm wasn't installing the package. Once I added "node-red" to the dependency list I was able to get everything working.

Thanks!

---

<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:** [20 May 2020 13:24 UTC](https://discourse.nodered.org/t/cannot-seem-to-start-node-red-docker-custom-container/26168/7 "2020-05-20T13:24:29Z")

</div>

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