# Docker, build your custom image, entry point in error

**URL:** <https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057>\
**Category:** General\
**Created:** [2 May 2021 14:06 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057 "2021-05-02T14:06:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [2 May 2021 14:06 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/1 "2021-05-02T14:06:54Z")

</div>

Hello, I try to create a custom docker image.  
I followed the [documentation](https://nodered.org/docs/getting-started/docker#dockerfile-which-copies-in-local-resources) well, but I can't launch the container. It doesn't find the entry point (see log below)  
I have according the doc. modified the _ **package.json** _ file to include the scripts section  
(the documentation is not precise enough on the syntax for me) See the snapshot below.

Could you please tell me where I'm doing things wrong? Thanks in advance.

**Log:**

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/e/5efb9759a24ffee7555808a6a07fcfc1cc37cd16.png)

**Dockerfile:**  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/f/cfca9d939be39c5536eba3933b50177f06ea5e8a.png)  
**package.json**  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/e/ce8da0b9365f97a50ff140cee64b753e4308baf3.png)

---

<div class="post-metadata">

**Author:** ![droberts](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/droberts/32/40295_2.png) [@droberts](https://discourse.nodered.org/u/droberts)\
**Post date:** [3 May 2021 11:40 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/2 "2021-05-03T11:40:31Z")

</div>

I have used the files and instructions here - [node-red-docker/docker-custom at master · node-red/node-red-docker · GitHub](https://github.com/node-red/node-red-docker/tree/master/docker-custom) - to successfully build and deploy a docker image.

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [3 May 2021 17:54 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/3 "2021-05-03T17:54:14Z")

</div>

It looks like a lot of work to me 🤔  
I'll dive into it tomorrow if I have enough time. Thanks for the pointer to this link.

---

<div class="post-metadata">

**Author:** ![droberts](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/droberts/32/40295_2.png) [@droberts](https://discourse.nodered.org/u/droberts)\
**Post date:** [3 May 2021 18:32 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/4 "2021-05-03T18:32:44Z")

</div>

I was a bit overwhelmed as well at first, but in essence all you need to do is put your flow file into your downloaded copy of that repository, put your dependencies in the package.json file and run the build shell script. I used the alpine Linux one as you end up with a smaller image, and it 'just worked'.

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [4 May 2021 08:17 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/5 "2021-05-04T08:17:15Z")

</div>

> [@Jean-Luc](#):
>
> I have according the doc. modified the _ **package.json** _ file to include the scripts section  
> (the documentation is not precise enough on the syntax for me) See the snapshot below.
> 
> Could you please tell me where I'm doing things wrong? Thanks in advance.

I admit that I don't immediately understand why you are getting that error.  
I have checked that folder for my container and it contains red.js:

```auto
bash-5.0$ pwd
/usr/src/node-red/node_modules/node-red
bash-5.0$ ls
CHANGELOG.md LICENSE README.md bin lib package.json red.js settings.js
bash-5.0$ 

```

... but I noted that my package.json doesn't contain the start command.

So here a copy of my package.json (I have removed 2 dependencies from it).

```auto
{
    "name": "node-red-mydrive-ctrl",
    "description": "Node-RED My-Drive Controller",
    "version": "0.0.1",
    "dependencies": {
        "node-red-node-daemon": "0.2.1",
        "node-red-dashboard": "2.29.0"
    },
    "node-red": {
        "settings": {
            "flowFile": "flows.json",
            "credentialsFile": "flows_cred.json"
        }
    }
}

```

So can you update your package.json to make it more like mine (or test in the first place with my package.json) and check if that not fixes the problem ?

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [4 May 2021 15:26 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/6 "2021-05-04T15:26:01Z")

</div>

Here is the result, I used your file directly.  
It doesn't work.  
In the doc, it is well written that it is necessary to put a section scripts ?!  
I can't even go into the container because it is stopped.

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

Maybe this is due to the use of [Portainer.io](http://Portainer.io) to create the containers.  
_(Or the architecture of the orangePi is not adapted)_

**Files used:**  
Dockerfile  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dc93e3b094f3441a6b633516ca2ada1c798f7ee1.png)  
Package.json  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/72f534cb059b18bbebd3921c5332cd304eac6e71.png)

**Command used:**

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/b/abec56ff98302c605ceb8cb240ed441170976fab.png)

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [4 May 2021 16:01 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/7 "2021-05-04T16:01:28Z")

</div>

Tested with no luck. It seems that it is not the same processor architecture.  
_(Orange Pi PC - Chinese Raspberry Pi clone with Allwinner ARMv7 processor)_

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

So I changed in the file Dockerfile.custom amd64 by arm or arm64 or armhf but it is not better.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/1/81e22f73f531f0215d43631941602b91ada9802e.png)

I also tried with the parameter --build-arg ARCH=arm32v7

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

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [4 May 2021 16:31 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/8 "2021-05-04T16:31:25Z")

</div>

> [@Jean-Luc](#):
>
> It doesn't work.

Indeed (my fault). It is expecting that the packages are installed under /data folder.

The following Dockerfile should work:

```auto
FROM nodered/node-red

COPY package.json /data/
# The following command will build all the nodes specified in the package.json that is copied
# in previous command.
RUN cd /data; npm install --unsafe-perm --no-update-notifier --no-fund --only=production

```

If that doesn't work then you can add an ENTRYPOINT to explicitly run the start specifying the /data folder as userDir.

```auto
FROM nodered/node-red:1.2.9-12

COPY package.json /data/
# The following command will build all the nodes specified in the package.json that is copied
# in previous command.
RUN cd /data; npm install --unsafe-perm --no-update-notifier --no-fund --only=production

ENTRYPOINT npm start -- --userDir /data

```

---

<div class="post-metadata">

**Author:** ![Jean-Luc](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jean-luc/32/89996_2.png) [@Jean-Luc](https://discourse.nodered.org/u/Jean-Luc)\
**Post date:** [4 May 2021 19:39 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/9 "2021-05-04T19:39:41Z")

</div>

Yes, that's it, it works as desired. ✌  
The customised container works.  
Variables go well in the directory, flows are well recognized, packages are well installed. It's cool,It's cool, it's pleasant.

The next step is coming.  
Can I start a docker pull (upgrade) automatically from a live flow NR when there will be a new version that I will have dropped on dockerhub ?  
I will investigate this now.  
The never ending story, it's fun 🙂

---

<div class="post-metadata">

**Author:** ![janvda](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/janvda/32/234_2.png) [@janvda](https://discourse.nodered.org/u/janvda)\
**Post date:** [4 May 2021 19:55 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/10 "2021-05-04T19:55:40Z")

</div>

> [@janvda](#):
>
> Indeed (my fault). It is expecting that the packages are installed under /data folder.

I think that that statement is not true.

The problem was that the docker command `COPY package.json . ` that we used earlier is overwriting the existing node-red `package.json` that is specifying the start script. So that is the reason it couldn't find the start script.

So by copying it to another folder (e.g. to the /data folder) we fixed the problem.

---

<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 May 2021 19:56 UTC](https://discourse.nodered.org/t/docker-build-your-custom-image-entry-point-in-error/45057/11 "2021-05-18T19:56:40Z")

</div>

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